<template>
	<view :style="{ 'background-color': 'black' }" class="container999" id="container999">
		<videoNavTop @topBack="backIndexPage" :hasInit="hasInit"
			:sequence="videoList.length > 0 && hasInit ? videoList[currentIndex]['sequence'] : -1"></videoNavTop>
		<videoSidebar ref="videoSidebar" @chooseTitle="chooseTitle" @isShare="isShare"
			v-if="videoInfoList[currentIndex] && !foucsKsPopup && !masterShow" v-show="!(halfVideo || noUseVideo) && showAll"
			:isHideBars="isHideBars" @likeClick="likeClick" @zjClick="zjClick" :templateIds="templateIds"
			:videoItem="videoInfoList[currentIndex]" :compInfo="compInfo" :foucsKsPopup="foucsKsPopup" @tapMaster="tapMaster"
			@showCz="showCz" @showGz="showGz" @cancelGz="cancelGz" :dyShowGz="statusFollow"></videoSidebar>
		<!-- #ifdef MP-KUAISHOU -->
		<view @touchstart="videoTouchStart" @touchmove="videoTouchMove" @touchend="videoTouchEnd" :style="{
			transform: `translateY(${moveY}px)`,
			position: 'relative',
			zIndex: '99'
		}">
			<image class="isVideo" mode="aspectFill"
				:style="{ height: videoList[currentIndex]['inducedCoverImgUrl'] && !userLock ? calHeight : 'calc(100vh - 132rpx - env(safe-area-inset-bottom))' }"
				style="position: relative;z-index: 55;width: 100vw;"
				v-if="(videoList[currentIndex] && videoList[currentIndex]['needUnLock']) || foucsKsPopup"
				:src="videoList[currentIndex]['inducedCoverImgUrl'] || videoList[currentIndex]['coverImgUrl']">
			</image>
			<view
				v-if="videoUrlList.length > 0 && hasInit && videoUrlList[currentIndex] && !videoList[currentIndex]['needUnLock'] && !foucsKsPopup"
				:style="{ height: halfVideo ? calHeight : 'calc(100vh - 132rpx - env(safe-area-inset-bottom))' }"
				:class="halfVideo ? 'videoChoose' : 'videoBox'">
				<video :show-fullscreen-btn="false" :show-center-play-btn="false" v-if="videoUrlList[currentIndex] && !noUseVideo"
					:object-fit="halfVideo || videoInfoList[currentIndex]['needContain'] == 'contain' ? 'contain' : 'cover'"
					:style="{ height: halfVideo ? calHeight : 'calc(100vh - 132rpx - env(safe-area-inset-bottom))' }"
					class="isVideo" id="myVideo" :src="videoUrlList[currentIndex] ? videoUrlList[currentIndex] : ''" @play="isPlay"
					@pause="isPause" :autoplay="true" @ended="isEnded" @error="videoError">
				</video>

				<view v-if="icpNumber && viewIcpNumber" class="icp-box">
					<text> 备案号: {{ icpNumber }}</text>
				</view>
				<!-- <view v-if="userInfo && userInfo.productUserId" class="uid-box">
					id:{{ userInfo.productUserId }}
				</view> -->
			</view>

			<lockPopup @viewBox="handleViewBoxSet" @chooseSeq="chooseSeq" @isNext="isNext" @isLast="isLast" @buyClick="buyClick"
				@buyClick1="buyClick1" v-if="showLock && !userLock" ref="lockPopup" @onlyLockAd="onlyLockAd" :balance="balance"
				@isClose="lockClose" :tempJujiCheck="tempJuji[fakeId]" :compInfo="compInfo" @lockAdsClick="lockAdsClick"
				:videoInfo="videoList[currentIndex]" :viewBox="viewBox">
			</lockPopup>

			<lockUserPopup :title="compInfo.title" :nowItem="videoList[currentIndex]" @userLockBtnClick="userLockBtnClick"
				:userLockId="userLockId" v-if="showLock && userLock"></lockUserPopup>

			<moneyPopup @czSuccess="czSuccess" :videoInfo="videoList[currentIndex]" v-if="showMoney" @isClose="moneyClose"
				:balance="balance" :copyLinkStatusIndex="copyLinkStatus" :type="isIaaAd ? 'isIaaAd' : ''" @iaaClose="handleIaaClose">
				<block slot="topMess">
					<view class="flex flex-direction align-center margin-bottom-lg">
						<view class="text-one">《{{ compInfo.title }}》第{{ (videoList[currentIndex] || {}).sequence + 1 }}集</view>
						<view class="text-two">为保护创作者权益，当前内容要付费后观看</view>
						<!-- <view class="flex align-end text-three">
							<text>本集：</text>
							<text class="num-box">{{ (videoList[currentIndex] || {}).goodsLocks[0] ? (videoList[currentIndex] || {}).goodsLocks[0].fruitNum : 0 }}</text>
							<text style="color: #FB4B06;">{{ moneyName }}</text>
						</view> -->
					</view>
				</block>
			</moneyPopup>
			<zwyPopupAll :showClose="false" :maskCanClose="false" ref="beforeBuyAlert">
				<view v-if="setViewAlertTwo" class="guide-box">
					<view class="text-box padding-set">不能跳跃观看，请返回继续观看</view>
					<view class="btn-set" @click="viewAlertBoxClose">确认</view>
				</view>
			</zwyPopupAll>
			<dramaList v-if="showDramaList" @isZj="isZj" @isClose="dramaListClose" @changeTab="changeTab"
				:currentIndex="currentIndex" :list="videoList" :compInfo="compInfo" @viewAlertBuyBefore="viewAlertBuyBefore">
			</dramaList>

		</view>
		<!-- 一键关注 -->

		<view v-if="showFollow" class="follow-bottom" :class="showFollowClass ? 'animation-fade-in' : 'animation-fade-out'">
			<follow-services @follow="tapFollow"></follow-services>
		</view>
		<foucs-popup :show="foucsKsPopup" @isClose="closeksFoucs" :calHeight="calHeight"
			:currentVideo="videoList[currentIndex]" @follow="tapFollow" :ksPiontIsclose="ksPiontIsclose"></foucs-popup>
		<!-- 推广 -->
		<mountPopup :viewShow="masterShow" @isClose="tapMaster"></mountPopup>
		<!-- 手势引导图 -->
		<cover-view v-if="viewGuide" class="popup-guide" @click="viewGuide = false">
			<cover-view class="content-box flex flex-direction align-center justify-center">
				<cover-view class="flex flex-direction align-center">
					<cover-image class="img-one"
						src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/guide_last.png"></cover-image>
					<cover-view>上滑进入下一集</cover-view>
				</cover-view>
				<cover-view class="flex flex-direction align-center">
					<cover-image class="img-two"
						src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/guide_next.png"></cover-image>
					<cover-view>下滑进入上一集</cover-view>
				</cover-view>
			</cover-view>
		</cover-view>
		<!-- #endif -->
		<!-- #ifdef MP-TOUTIAO -->
		<swiper v-if="videoUrlList.length > 0" vertical :duration="duration" @change="swiperChange"
			@animationfinish="anFinish" :current="currentIndex" :disable-programmatic-animation="true" class="videoBox"
			style="height: 100vh;">
			<template v-for="(item, index) in videoList">
				<swiper-item v-show="index <= currentIndex + 1" :key="index">
					<image :style="{ height: playerH, top: playerT + 'px' }" class="swiperPoster"
						v-if="(!videoUrlList[index] || item.needUnLock) && (index == currentIndex || index == currentIndex + 1 || index == currentIndex - 1)"
						:src="item['coverImgUrl']"></image>
					<block v-if="videoInfoList[index].newPlayer && isCanUseNewPlayer">
						<view 
							class="zwyVideoBox" :style="{ height: playerH, top: playerT + 'px' }" 
							v-if="index == currentIndex && videoUrlList[index] && !item.needUnLock" 
						>
							<video-player
								:id="`newPlayVideo${item.videoId}`"
								:album-id="videoInfoList[index].albumId"
								:cloud-type="1"
								:episode-id="videoInfoList[index].episodeId"
								:object-fit="videoInfoList[index]['objectFit'] ? videoInfoList[index]['objectFit'] : 'contain'"
								:style="{ height: playerH, width: '100vw'}"
								:controls="false"
								:enable-play-gesture="false"
								:enable-progress-gesture="false"
								:autoplay="index == currentIndex"
								@play="isPlay"
								@timeupdate="timeupdateNewPlayer"
								onEnded="isEndedNewPlayer"
								@getVideoInfo="getVideoInfoNewPlayer"
								@error="handleError"
							>
								<view @click.stop="videoClick" style="width: 100vw;height: 100vh;position: relative;z-index: 99;"></view>
								<zwyLoading v-if="index == currentIndex && showLoadingNewPlayer"></zwyLoading>
							</video-player>
							<zwyVideoProgress
								@isPause="isPauseNewPlayer"
								@playNow="playNowNewPlayer"
								v-show="isHideBars"
								:isHideBars="isHideBars"
								:isPlayNow="isPlayNowNewPlayer"
								:currentTime="currentTimeNewPlayer"
								:duration="durationNewPlayer"
								@isChangingFunc="isChangingFuncNewPlayer"
								@sliderEnd="sliderEndNewPlayer">
							</zwyVideoProgress>
						</view>
					</block>
					<block v-else>
						<zwyVideo @videoClick="videoClick" :isHideBars="isHideBars" :playerH="playerH" :playerT="playerT"
							:coverImgUrl="item['coverImgUrl']" :videoInfo="videoInfoList[index]"
							v-if="(index == currentIndex || index == currentIndex + 1) && videoUrlList[index] && !item.needUnLock"
							:index="index"  :totalFreeTime="totalFreeTime" :templateIds="templateIds" :currentIndex="currentIndex" :videoUrl="videoUrlList[index]" @ended="isEnded"
							@play="isPlay" @hideBars="hideBars" :imageArr="imageArr" @dbClick='dbClick' :pauseNum="pauseNum" ref='zwyVideo'></zwyVideo>
					</block>

					<lockPopupTT
						@viewBox="handleViewBoxSet"
						@chooseSeq="chooseSeq"
						@isNext="isNext"
						@isLast="isLast"
						@buyClick="buyClick"
						v-if="index == currentIndex && showLock && (!userLock || !isShowUserLock)"
						ref="lockPopup"
						@onlyLockAd="onlyLockAd"
						:balance="balance"
						@isClose="lockClose"
						:compInfo="compInfo"
						@lockAdsClick="lockAdsClick"
						:videoInfo="videoList[currentIndex]"
						:viewBox="viewBox">
					</lockPopupTT>
					<lockUserPopupTT :title="compInfo.title" :nowItem="videoList[currentIndex]" @userLockBtnClick="userLockBtnClick"
						@followBtn="followBtnStatus" @closePopup="handleClosePopupTT" :userLockId="userLockId"
						:isShowCloseBtn="!!(buySpace > 0)" v-if="index == currentIndex && showLock && userLock && isShowUserLock">
					</lockUserPopupTT>
					<!-- #ifdef MP-TOUTIAO -->
					<!-- 顶部返回 -->
					<view class="top-alert" :style="{ top: `${ playerT + 10 }px` }" @tap="topBack('leftTop')">
						<view class="left-box">返回</view>
						<view class="right-box">{{ sequenceDes }}</view>
					</view>
					<moneyPopupTT @czSuccess="czSuccess"  fromPage="video" :videoInfo="videoList[currentIndex]"
						v-if="showMoney && index == currentIndex" :copyIntervalTime="copyIntervalTime" @isClose="moneyClose"
					 	:type="isIaaAd ? 'isIaaAd' : ''" :balance="balance" :copyLinkStatusIndex="copyLinkStatus" @iaaClose="handleIaaClose">
						<block slot="topMess">
							<view class="flex flex-direction align-center margin-bottom-lg">
								<view class="text-one">《{{ compInfo.title }}》第{{ (videoList[currentIndex] || {}).sequence + 1 }}集</view>
								<view class="text-two">为保护创作者权益，当前内容要付费后观看</view>
								<!-- <view class="flex align-end text-three">
									<text>本集：</text>
									<text class="num-box">{{ (videoList[currentIndex] || {}).goodsLocks[0] ? (videoList[currentIndex] || {}).goodsLocks[0].fruitNum : 0 }}</text>
									<text style="color: #FB4B06;">{{ moneyName }}</text>
								</view> -->
							</view>
						</block>
					</moneyPopupTT>

					<zwyPopupAll v-if="index == currentIndex" :showClose="false" :maskCanClose="false" ref="beforeBuyAlert">
						<view v-if="setViewAlertTwo" class="guide-box">
							<view class="text-box padding-set">不能跳跃观看，请返回继续观看</view>
							<view class="btn-set" @click="viewAlertBoxClose">确认</view>
						</view>
					</zwyPopupAll>
					<mountPopup v-if="index == currentIndex" :viewShow="masterShow" @isClose="tapMaster"></mountPopup>
					<view v-if="icpNumber && viewIcpNumber" class="icp-box">
						<text> 备案号: {{ icpNumber }}</text>
					</view>
					<!-- <view v-if="userInfo && userInfo.productUserId" class="uid-box">
						id:{{ userInfo.productUserId }}
					</view> -->
					<!-- #endif -->
				</swiper-item>
			</template>
		</swiper>
		<!-- 手机号获取弹窗 -->
		<view class="loginFlag" v-show="!isPhone && showLogin">
			<view class="loginFlag-top">
				<view class="login-title">登录解锁更多精彩</view>
				<image class="close-img" @click="loginClose"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/ttclose.png">
				</image>
			</view>
			<image class="icon-content"
				src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/tt_icon.png"></image>
			<button class="loginFlag-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumberDouYin">登录</button>
		</view>
		<view class="loginFlag" v-show="!isPhone && successFlag">
			<view class="loginFlag-top">
				<view class="login-title">恭喜您充值成功</view>
				<image class="close-img" @click="czSuccessClose"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/ttclose.png">
				</image>
			</view>
			<view class="login-text">为了您的账户安全，请登录后观看</view>
			<button class="loginFlag-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumberDouYin">登录</button>
		</view>
		<button v-if="safeguard && isSafeguard && showLogin && showIcon" open-type="getPhoneNumber"
			@getphonenumber="getPhoneNumberDouYin">
			<image class="safeguard"
				src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/safeguard.png"></image>
		</button>
		<!-- #endif -->
		<view v-if="videoUrlList.length === 0 || !hasInit">
			<zwySkeleton></zwySkeleton>
		</view>
		<chooseBoxIndexNew v-if="videoList.length > 0 && !isHideBars" :sequence="videoList[currentIndex]['sequence']"
			v-show="!showDramaList && ((clientName == 'MP-TOUTIAO' && !showLock) || clientName == 'MP-KUAISHOU') && !needHideChoose"
			:isShowBtnPlay="isShowBtnPlay" @videoPause="videoPause" @videoPlay="videoPlay" @chooseSeq="chooseSeq" :white="true"
			:compInfo="compInfo" @isNext="isNext" @isLast="isLast"></chooseBoxIndexNew>
		<!-- #ifdef MP-TOUTIAO -->
		<dramaListTt v-if="showDramaList" @isZj="isZj" @isClose="dramaListClose" @changeTab="changeTab"
			:currentIndex="currentIndex" :list="videoList" :compInfo="compInfo" @viewAlertBuyBefore="viewAlertBuyBefore">
		</dramaListTt>
		<!-- #endif -->
		<zwyNextTheater @isPlay="videoPlay" @isPause="videoPause" @isClose="nextTheaterClose" :compInfo="compInfo"
			v-if="showZwyNextTheater"></zwyNextTheater>

		<!-- #ifdef MP-KUAISHOU -->
		<rewardAd
			v-if="showAd && isIaaAd"
			ref="rewardAd"
			:nowAdTypeKs="nowAdTypeKs"
			@closeAdBox="handleCloseAd"
			@closeAdBoxAndUnlock="closeAdBoxAndUnlock"
		></rewardAd>
		<rewardAdKsFree
			v-if="showAd && !isIaaAd"
			ref="rewardAdKsFree"
			:nowAdTypeKs="nowAdTypeKs"
			@closeAdBox="handleCloseAd"
			@closeAdBoxAndUnlock="closeAdBoxAndUnlock"
		></rewardAdKsFree>
		<!-- #endif -->

		<zwyPopupAll :showClose="false" @popupIsClose="popupIsClose" :maskCanClose="false" ref="zwyPopupAll">
			<view v-if="showType == 'chooseTitle'" class="titleBox">
				<view @click="popupClose" class="isCloseBox">
					<image style="width: 61rpx;height: 61rpx;"
						src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/icon_close.png">
					</image>
				</view>
				<view class="isTitle">推广标题</view>
				<view style="height: 500rpx;overflow-y: scroll;" class="titleContent">
					<view v-for="(item, index) in shareList" :key="index" @click="titleChooseIndex(index)" class="titleLine">
						<view class="titileNum">推广标题{{ index + 1 }}:</view>
						<input v-if="item.custom" class="titleDetail" v-model="item.guideWords" type="text" placeholder="请输入文本" />
						<view v-if="!item.custom" class="titleDetail">{{ item.guideWords }}</view>
						<view class="isChoose">
							<image v-if="titleIndex == index" style="width: 30rpx;height: 30rpx;"
								src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/icon_greenYes.png">
							</image>
						</view>
					</view>
				</view>
				<view @click="titleSure" class="titleSureBtn">确认</view>
			</view>
			<view v-if="showType == 'adFail'" class="adFailBox">
				<view>
					<view @click="popupClose" style="top: 0;right: 0;display: flex;align-items: center;justify-content: center;"
						class="isCloseBox">
						<image style="width: 28rpx;height: 28rpx;"
							src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/icon_adClose.png">
						</image>
					</view>
					<view class="adFailTitle">解锁失败</view>
					<view class="adFailDes">广告溜走了，一会再来试试把~</view>
					<view v-if="btnType == 1" class="btnBox">
						<view @click="isBack" class="nomalBtn">返回首页</view>
						<view @click="isZj" v-if="!compInfo.subscribe" class="mainBtn">加入追剧</view>
					</view>
					<view v-else-if="btnType == 2" class="btnBox">
						<view @click="isBack" v-if="compInfo.subscribe" class="nomalBtn">返回首页</view>
						<view @click="isZj" v-if="!compInfo.subscribe" class="nomalBtn">加入追剧</view>
						<view @click="isAdLockEpisodic" class="mainBtn">{{ moneyName }}支付</view>
					</view>
					<view v-else-if="btnType == 3" class="btnBox">
						<view @click="isBack" v-if="compInfo.subscribe" class="nomalBtn">返回首页</view>
						<view @click="isZj" v-if="!compInfo.subscribe" class="nomalBtn">加入追剧</view>
						<view @click="isAdLockCompilations" class="mainBtn">全集购买</view>
					</view>
				</view>
			</view>
			
			
			<view v-if="showType == 'chatTTpopup'" class="chatBox">
				<view class="isContent">
					<button :data-is-half-page="true" @click="joinClick" open-type="joinGroup" class="joinBtn" :group-id="dyDiverInfo.groupId"></button>
					<image style="width: 630rpx;height: 640rpx;position:relative;z-index: 9;" src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/jinqun/icon_qunBg.png"></image>
				</view>
				<image @click.stop="isBack" class="closeImg" src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/jinqun/icon_qunClose.png"></image>
			</view>
			
			<view style="display: flex;flex-direction:column;align-items:center;" v-if="showType == 'zjTTpopup'">
				<view class="adFailBox" style="position:relative;">
					<view class="adFailTitle">加入追剧</view>
					<view class="adFailDes">喜欢本剧就加入追剧吧</view>
					<view class="btnBox">
						<view @click="isBack" class="nomalBtn">不用了</view>
						<view @click="isZj('back')" v-if="!compInfo.subscribe" class="mainBtn TTcolor">加入追剧</view>
					</view>
				</view>
				<chatBtnFixed v-if="dyDiverInfo.groupId" :dyDiverInfo="dyDiverInfo"></chatBtnFixed>
			</view>
			<view v-if="showType == 'czKSpopup'" @click="showKbActivity('first')" class="czPopupKSBox">
				<view v-if="isTime != -1" class="timeBoxCzKS">
					<countTime bg="#ffffff00" fontColor="#FE6E24" @timeFinish="timeFinish" :countTime="isTime"></countTime>
					<text style="margin-left: 10rpx;color: #232323;">后失效</text>
				</view>
				<image src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/ks_czPopup.png" class="czPopupKS">
				</image>
				<image style="top:-20rpx;right:0;" @click.stop="czPopupClose"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/closeBlack.png" class="closeBlackKS">
				</image>
				<image src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/czButton.png"
					class="czButton breathe"></image>
				<view class="oriKb">原价19.9</view>
			</view>

			<view @click="showKbActivity('rightUseAfter')" v-if="showType == 'czTTpopupAfterKS'" class="czPopupTTBoxKS">
				<image src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/ks_czAfter.png"
					class="czPopupTTAfterKS"></image>
				<view class="ksRightUse breathe">立即使用</view>
				<view class="isFangqi" @click.stop="czPopupCloseAfter">狠心放弃</view>
			</view>
			<view v-if="showType == 'czTTpopup'" class="czPopupTTBox">
				<view v-if="isTime != -1" class="timeBoxCz">
					<countTime bg="#ffffff38" fontColor="#AC561A" @timeFinish="timeFinish" :countTime="isTime"></countTime>
					<text style="margin-left: 10rpx;">后失效</text>
				</view>
				<image @click="showKbActivity('first')"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/tt_czPopup2.png"
					class="czPopupTT"></image>
				<image @click="czPopupClose"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/closeBlack.png" class="closeBlack">
				</image>
			</view>
			<view v-if="showType == 'czTTpopupAfter'" class="czPopupTTBox">
				<image src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/tt_czAfter.png"
					class="czPopupTTAfter"></image>
				<view @click="showKbActivity('rightUseAfter')" class="afterBtn1">20元红包立即领取</view>
				<view @click="showKbActivity('five')" class="afterBtn2">现在充值，6折优惠</view>
				<image @click="czPopupCloseAfter"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/closeBlack.png" class="closeBlack">
				</image>
			</view>
			<view v-if="showType == 'zjKSpopup'" class="adFailBox">
				<view>
					<view class="adFailTitle">加入追剧</view>
					<view class="adFailDes">喜欢本剧就加入追剧吧</view>
					<view class="btnBox">
						<view @click="isBack" class="nomalBtn">不用了</view>
						<view @click="isZj('back')" v-if="!compInfo.subscribe" class="mainBtn KScolor">加入追剧</view>
					</view>
				</view>
			</view>
		</zwyPopupAll>

		<!-- #ifdef MP-TOUTIAO -->
		<view class="fixed-button" v-if="darenChoose && nowScene !== '021014'">
			<button class="btn-style" open-type="share" data-channel="video">拍视频</button>
		</view>
		<!-- 抖音激励广告 锁展示时且有广告锁时触发  v-if="showAd && isIaaAd" -->
		<rewardAdTt @closeAdBox="handleCloseAd" @closeAdBoxAndUnlock="closeAdBoxAndUnlock" :isIaaAd="isIaaAd" ref="rewardAdTt" />
		<rewardAdTtFree @closeAdBoxAndUnlock="closeAdBoxAndUnlock" :isIaaAd="isIaaAd" ref="rewardAdTtFree" />
		<insertAdTt ref="insertAdTt" />

		<!-- #endif -->
		<!-- 抖音一键加群弹窗 -->
		<zwyPopupAll :showClose="false" :maskCanClose="false" ref="popupBox">
			<view v-if="addGroupStyle == 1" class="content-popup" :show-menu-by-longpress="true">
				<view class="img-box">
					热门短剧，在线观看
				</view>
				<view class="code-mess">
					<view class="line"></view>
					<view style="margin:0 19rpx">
						倒计时 {{ countdown }} 秒
					</view>
					<view class="line"></view>
				</view>
				<button class="content-btn" open-type="joinGroup" :data-is-half-page="true" :group-id="groupId" @click="handleJoinGroup">点击进入</button>
				<image v-if="closeFlag" @click.stop="handleClosePopup" class="close-btn"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/hongbao_closeWhite.png"></image>
			</view>
			<view v-if="addGroupStyle == 2" class="content-popup1" :show-menu-by-longpress="true">
				<button class="add-group" open-type="joinGroup" :data-is-half-page="true" :group-id="groupId" @click="handleJoinGroup"></button>
				<image v-if="closeFlag" @click.stop="handleClosePopup" class="close-btn2"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/hongbao_closeWhite.png"></image>
			</view>
			<view v-if="addGroupStyle == 3" class="content-popup2">
				<button class="add-group1"  open-type="joinGroup" :data-is-half-page="true" :group-id="groupId" @click="handleJoinGroup"></button>
				<image v-if="closeFlag" @click.stop="handleClosePopup" class="close-btn3"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/hongbao_closeWhite.png"></image>
			</view>
		</zwyPopupAll>

		<zwyPopupAll :showClose="false" @popupIsClose="popupIsClose" :maskCanClose="false" ref="addPopupBox">
			<view class="ad-box-all">
				<image @tap="handleCloseAdBtn" class="close-btn"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/active/close_white.png"
					mode="widthFix"></image>
				<image @tap="handleCloseAd" class="mark-btn"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/active/ad_view_mark.gif"
					mode="widthFix"></image>
				<image @click="viewAdBox" class="img-box-ad"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/active/ad_view_load.png"
					mode="widthFix"></image>
					<view v-if="viewAdTime && viewAdTime > 0" class="time-box">{{ viewAdTime }}秒后自动广告解锁后续</view>
			</view>
		</zwyPopupAll>

		<!-- 双击点赞 -->
		<view v-for="(item, index) in imageArr" :key="index">
			<image :id="index" style="position: fixed"
				src="https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/toutiao/video_like1.png"
				class="videoZan-play"></image>
		</view>

		<!-- 抖音加群图标 -->
		<!-- #ifdef MP-TOUTIAO -->
		<!-- 加关 -->
		<view v-if="dyInterestShow"
			style="position: fixed; bottom: 240rpx; left: 20rpx;right: 15rpx;z-index: 9999;display: flex;justify-content: center;">
			<image v-if="guideDialogSwitch" @click="closeDyInterest"
				style="width: 30rpx;height: 30rpx;position: absolute;top: -34rpx;right: 0rpx;"
				src="https://res.qiguoread.com/staticResources/fellow_townsman/image/close_btn_active.png" lazy-load
				mode="aspectFill"></image>
			<aweme-user-card :width="width" :aweme-id="awemeId" :height="height" @bindError="onerror"
				:fixed="fixed"></aweme-user-card>
		</view>
		<!-- 加群icon -->
		<view v-if="dyBtnGroupId" style="width: 79rpx;height: 200rpx;position: fixed;top: 213rpx;right: 10rpx;z-index: 999;">
			<button class="video-group-btn" open-type="joinGroup" :data-is-half-page="true" :group-id="dyBtnGroupId" @click="handleJoinGroup1(1)"></button>
		</view>
		<!-- 加群弹窗 -->
		<zwyPopupAll :showClose="false" :maskCanClose="false" ref="dyGroupPopupBox">
			<view class="dy-popup-Box">
				<!-- getApp().globalData.dyGroupMess.groupId -->
				<image v-if="groupCloseSwitch" @click.stop="handleCloseDyPopup" class="close-btn"
					src="https://res.qiguoread.com/staticResources/fellow_townsman/image/jiaqun_video_close.png"></image>
					<button class="add-group-btn" open-type="joinGroup" :data-is-half-page="true" :group-id="dyGroupId" @click="handleJoinGroup1(2)">立即加入</button>
			</view>
		</zwyPopupAll>
		<!-- #endif -->
	</view>
</template>
<script>
	import chatBtnFixed from './components/chatBtnFixed.vue';
import countTime from './components/countTime.vue';
import lockUserPopup from './components/lockUserPopup.vue';
import lockUserPopupTT from './components/lockUserPopupTT.vue';
import videoNavTop from './components/videoNavTop.vue';
import chooseBoxIndexNew from './components/chooseBoxIndexNew.vue';
import dramaList from './components/dramaList.vue';
import dramaListTt from './components/dramaListTt.vue';
import moneyPopup from '../../components/moneyPopup.vue';
import moneyPopupTT from '../../components/moneyPopupTT.vue';
import zwySkeleton from '../../components/zwySkeleton.vue';
import zwyVideo from './components/zwyVideo.vue';
import videoSidebar from './components/videoSidebar.vue';
import lockPopup from './components/lockPopup.vue';
import lockPopupTT from './components/lockPopupTT.vue';
import rewardAd from './components/rewardAd.vue';
import rewardAdKsFree from './components/rewardAdKsFree.vue';
import rewardAdTt from './components/rewardAdTt.vue';
import rewardAdTtFree from './components/rewardAdTtFree.vue';
import insertAdTt from './components/insertAdTt.vue';
import zwyNextTheater from './components/zwyNextTheater.vue';
import foucsPopup from './components/foucsPopup.vue'
import FollowServices from './components/followServices.vue';
import mountPopup from './components/mountPopup.vue';
import { getOrderTtMess, intoPayPage, getLittleAppNowObj } from '@/util/ttPay'
// #ifdef MP-TOUTIAO
import zwyVideoProgress from './components/zwyVideoProgress.vue';
// #endif

const util = require('../../util/util.js');
// 抖音配置
let ttConfig = require("../../util/ttConfigSet.js");
export default {
	components: {
		chatBtnFixed,
		countTime,
		lockUserPopup,
		lockUserPopupTT,
		chooseBoxIndexNew,
		dramaList,
		lockPopup,
		lockPopupTT,
		moneyPopup,
		zwySkeleton,
		videoNavTop,
		zwyVideo,
		videoSidebar,
		rewardAd,
		rewardAdKsFree,
		zwyNextTheater,
		moneyPopupTT,
		dramaListTt,
		foucsPopup,
		FollowServices,
		rewardAdTt,
		mountPopup,
		insertAdTt,
		rewardAdTtFree
		// #ifdef MP-TOUTIAO
		,
		zwyVideoProgress
		// #endif
	},
	data() {
		return {
			dyDiverInfo:'',
			showLoadingNewPlayer: true,
			newContentVideo: null,
			isPlayNowNewPlayer: false,
			currentTimeNewPlayer: 0,
			durationNewPlayer: 0,
			testVideo: true,
			adBox: '',
			batchEnter: false,
			userLockArr: [{
				id: 26706,
				clientType: 'KUAI_SHOU_MINI_PROGRAM',
				releaseWay: 'USER_LOCK',
				userLockId: 2670056352,
				lockType: 'COMPILATIONS',
				goodsType: 'COMPILATIONS',
				goodsId: 8812,
				compilationsId: 8812,
				beginWithEpisodicSequence: 19,
				effectiveType: 'ALL_EFFECTIVE',
				officialAccountsOriginalId: '',
				officialAccountsAppId: '',
				fruitNum: 500,
				directBuying: true,
				createTime: 1640930077000,
				updateTime: 1640930077000,
				hour24: 0,
				total: 0,
				logicDelete: 'NORMAL',
				commodityId: 36
			}],
			buySpace: 2,
			hasBuyNum: 0,
			userLock: false,
			userLockSequence: -1,
			userLockId: '',
			isHideBars: false,
			screenWidth: uni.getSystemInfoSync().windowWidth,
			needHideChoose: false,
			clientName: this.clientName,
			moneyName: this.moneyName,
			tempJuji: {
				'2VkZ': true,
				g0p7: true,
				a7yJ: true,
				'5g8z': true
			},
			compilationId: '',
			showZwyNextTheater: false, //123
			btnType: 1,
			showAd: false,
			hasInit: false,
			shareList: [],
			titleIndex: 0,
			isShowBtnPlay: true,
			showAll: true,
			duration: 0,
			isCoding: false,
			showMoney: false,
			showLock: false,
			showDramaList: false,
			fakeId: '',
			compilationId: '',
			balance: 0,
			compInfo: {},
			videoList: [],
			currentIndex: 0,
			disList: [],
			nowDes: 0,
			times: 0,
			isStop: true,
			videoUrlList: [],
			videoInfoList: [],
			hasPushList: [],
			hasBuyObj: {},
			showType: '',
			noUseVideo: false,
			isOnlyAd: false,
			wH: '',
			wW: '',
			playerT: 0,
			isTime: 0,
			playerH: '100%',
			statusBarHeight: '',
			userLockBtnHasClickSeq: -1,
			followTTMess: {}, // 抖音配置信息
			isFollowBtn: false, // 是否是点击立即关注离开小程
			watchword: '关注', // 抖音复制
			ttUserLock: false,
			batchIdNow: '', // 当前的链接batchID
			isShowUserLock: true, // 生命周期内是否展示关注锁
			viewBox: false,
			copyGroupLinkBefore: '', // 免费用户群链接
			copyGroupLinkBeforeId: '', // 免费用户群链接ID
			copyGroupLink: '', // 付费群口令
			copyGroupLinkId: '', // 付费群口令ID
			copyIntervalTime: null, // 定时复制
			oneDate: null, // 进入视频的时间
			canCopyGroupLink: false, // 规定时间内可以copy
			moveY: 0, // 移动距离
			scopeDis: 100, // 限制触发距离
			moveObj: {
				clientX: 0,
				clientY: 0
			},
			endMoveObj: {
				clientY: 0
			},
			viewGuide: false,
			safeguard: false,
			successFlag: false,
			isPhone: true,
			phoneFlag: false,
			showLogin: false,
			isSafeguard: false,
			showIcon: false,
			copyLinkStatus: false,
			nowScene: getApp().globalData.nowScene || '',
			darenChoose: getApp().globalData.darenChoose || false,
			//快手一键关注
			foucsKsPopup: false,//快手关注弹窗组件
			showFollow: false,//快手关注弹窗
			showFollowClass: false,
			ksPiontIsclose: false,//是否可关闭
			kstimer: null,
			followTimer: {
				startTime: null,
			},
			ksSpreaModeObj: {
				ksPointStartNum: 0,
				dialogRate: 1,
				currentLock: 1,
				addedFansRelativePosition: 0,
				spreadMode: '',
			},
			setViewAlertTwo: false,
			reqNum: 0,
			groupId: '',
			addGroupStyle: -1,
			closeFlag: false,
			adMessAll: {
				guideDialogSwitch: 1, // 激励视频是否可关闭 2：可关闭 1： 不可关闭
				iaaUnlockTimes: -1 // 广告弹窗次数
			},
			isIaaAd: false, // 是否走IAA逻辑
			countdown: '15',
			timer: null,
			closePopTime: null,
			totalFreeTime: 0,//免费总时长
			videoZan: false,
			imageArr: [],
			templateIds: [], // 订阅消息模板ID 1:海洋短剧  2: 剧多多 3:果果剧场
			masterShow: false,
			insertStartIndex: '', //起始集数
			insertSpace: '',
			insertAdTt: false,
			icpNumber: '',
			viewIcpNumber: false,
			userInfo: null,
			isFree: null,
			show: true,
			width: 650,
			height: 110,
			// padding: 32,
			fixed: true,
			dyInterestShow: false,
			awemeId: '',
			guideDialogSwitch: false,
			intervalId: null,
			nowAdTypeKs: '', // 当前广告类型
			groupCloseSwitch:false,
			dyGroupId:null,
			dyBtnGroupId:null,//播放页加群icon
			queryMess: null,
			nowAppName: '',
			versionView: false,
			imId: '',
			isCanUseNewPlayer: false,
			isFree:null,
			newVideoObj: {  // 从卡片过来新播放器ID获取存储
				episodeId: '',
				albumId: ''
			},
			pauseNum:0, //为0 不暂停视频,
			statusFollow: false,
			viewAdTime: 3, // 观看广告倒计时
			interValTime: null,
			positionIaa: '', // 当前IAA触发位置
			alreadyClick: false,
			iaaUnLockStr: '' // IAA解锁的随机参数标识
		};
	},
	destroyed() {
		getApp().globalData.zwyVideoDuration = {};
	},
	onShareAppMessage: function (res) {
		let nowItem = this.videoList[this.currentIndex];
		getApp().globalData.notSetWatchWord = true;
		this.$statis({
			action: 'FORWARD',
			compilationId: String(nowItem.compilationsId),
			episodicDramaId: String(nowItem.id),
			videoId: String(nowItem.videoId),
			authorId: this.compInfo.laikanAccountId ? String(this.compInfo.laikanAccountId) : '0',
			fakeId: String(nowItem.compilationsFakeId),
			shareType: 'MINI_PROGRAM_CARD'
		});
		var shareJson = {
			path: '/pages/fx_xjc/fx_xjc',
			data: {
				page: 'video',
				compilationId: this.compInfo.id,
				fakeId: this.compInfo.fakeId,
				enterSequence: this.currentIndex
			}
		};
		console.log(this.compInfo,'this.compInfo');
		// #ifdef MP-KUAISHOU
		if (getApp().globalData.shareBatchId) {
			shareJson.data.ks_third_id = this.compInfo.fakeId
		}
		if(getApp().globalData.isBusinessChain){
			shareJson.title = this.compInfo.title ? this.compInfo.title : this.compInfo.shareTitle;
		}else{
			shareJson.title = this.compInfo.shareTitle ? this.compInfo.shareTitle : this.compInfo.title;
		}

		// #endif

		// #ifdef MP-TOUTIAO
		shareJson.title = this.compInfo.introduce ? this.compInfo.introduce : this.compInfo.introduce;
		shareJson.introduce = this.compInfo.introduce ? this.compInfo.introduce : this.compInfo.introduce;
		shareJson.isFree = this.isFree
		// #endif
		if (this.shareList.length > 0 && this.shareList[this.titleIndex]['guideWords']) shareJson.title = this.shareList[this.titleIndex]['guideWords'];
		let item = nowItem;
		if (item) {
			var imageUrl = item.coverImgUrl;
			shareJson.imageUrl = this.compInfo.shareCover ? this.compInfo.shareCover : imageUrl;
			shareJson.data.episodicDramaId = item.id;
			shareJson.data.authorId = this.compInfo.laikanAccountId;
		}

		// 达人分享批次

		// 分享链接携带新播放器的EID和AID
		if(this.videoInfoList[this.currentIndex]) {
			shareJson.data.tt_album_id = this.videoInfoList[this.currentIndex].albumId
			shareJson.data.tt_episode_id = this.videoInfoList[this.currentIndex].episodeId
		}
		// #ifdef MP-TOUTIAO
		console.log(getApp().globalData.shareBatchId)
		if (getApp().globalData.shareBatchId) {
			shareJson.channel = 'video'
			shareJson.extra = {
				hashtag_list: ['精彩短剧热播中👈']
			}
		}

		let obj = this.formatShare(shareJson)
		return {
			...obj,
			success: (res) => {

				console.log("分享视频成功===>", res)
				const currentTimestamp = Math.floor(Date.now() / 1000);
				if (currentTimestamp - getApp().globalData.lastAdTimestamp > 180 && !getApp().globalData.isAdComeCheck) {
					// 曝光插屏广告
					setTimeout(() => {
						// #ifdef MP-TOUTIAO
						this.$refs.insertAdTt && this.$refs.insertAdTt.isShowAd()
						// #endif
					}, 1000);
					console.log('Show interstitial ad');
					// getApp().globalData.lastAdTimestamp = currentTimestamp;
				} else {
					console.log('Skip interstitial ad');
				}
			},
			fail(e) {
				console.log(e)
				console.log("分享视频失败")
			},
		}
		// #endif
		return this.formatShare(shareJson);
	},
	async onShow() {
		// 设置广告自动倒计时
		this.viewAdTime = 3
		// #ifdef MP-TOUTIAO
		this.isCanUseNewPlayer = tt.canIUse('video-player') || false
		console.log('isCanUseNewPlayer----', this.isCanUseNewPlayer)

		// 第一个参数是导流场景：1支付前，2支付后，3首页，4播放页按钮，第二个参数是导流目标，1是加关，2是加群
		this.getVideoBtnGroupInfo(4, 2)
		if (this.hasBuyNum == 0) {
			if(getApp().globalData.isOperateType){
				this.getDyDiversion(1, 1)
			}
			this.getGroupInfo(1, 2)
		} 
		let statusFollow = await this.getFollowCheckStatus()
		this.statusFollow =statusFollow.hasFollowed
		

		let ttAccountInfo = tt.getEnvInfoSync() && tt.getEnvInfoSync().microapp
		if (ttAccountInfo && ttAccountInfo.appId) {
			let ttConfigMess = ttConfig[ttAccountInfo.appId]
			getApp().globalData.nowTTClient = ttConfigMess.nowTTClient
			uni.setStorageSync('ttConfigMess', ttConfigMess)
			this.imId = ttConfigMess.imId
		}

		this.getLoginMess()
		const phoneValue = uni.getStorageSync('phoneFlag');
		const login = uni.getStorageSync('showLogin')
		if (phoneValue) {
			if (login !== "") {
				this.showLogin = uni.getStorageSync('showLogin');
			}
			this.getUserInfoMess1()

		}
		console.log(login, this.safeguard, this.isSafeguard, this.showLogin, this.showIcon, 'icon保护弹窗');
		if (this.safeguard) {
			wx.uma.trackEvent('Ume_video page_number_popup', {
				'Ume_number_icon': '播放页icon曝光'
			});
		}

		let imJump = uni.getStorageSync('imJump')
		let imJumpNewObj = uni.getStorageSync('imJumpNewObj')
		if(imJumpNewObj) { // 通用支付IOS同步订单
			let { orderId } = imJumpNewObj
			await getApp().czSucc(this, orderId)
			uni.removeStorageSync('imJumpNewObj')
		}
		if (imJump) {
			let val = ''
			if (imJump == 'ssVip') {
				val = {
					type: 'ssVipSuccess'
				}
			} else if (imJump == 'allVideo') {
				console.log('allVideo-------------')
				if (this.nowGoodsLock['directBuying']) {
					this.isBuyRight();
				} else {
					uni.showToast({
						title: '充值成功',
						icon: 'none'
					});
					this.noUseVideo = false;
					this.isBuy();
				}
			}
			this.czSuccess(val)
			uni.removeStorageSync('imJump')
		}
		// #endif
		let viewGuidePopup = uni.getStorageSync('viewGuidePopup')

		if (!viewGuidePopup) {
			this.viewGuide = true
			uni.setStorageSync('viewGuidePopup', true)
		}
		// this.cleanWatchWord();

		// #ifdef MP-TOUTIAO
		this.$disabledScreenRecord();
		// #endif

		// #ifdef MP-KUAISHOU
		setTimeout(() => {
			if (!getApp().globalData.backStage) {
				this.$disabledScreenRecord();
			}
		}, 5000);
		// #endif
		// #ifdef MP-TOUTIAO
		if (this.isFollowBtn && getApp().globalData.nowTTClient) {
			this.copyWatchword(this.watchword)
		}

		// 关注锁未生命周期未获得，再次请求
		if (!this.userLockId && getApp().globalData.batchId) {
			// 抖音关注锁相关配置
			await this.getLinkJump()
		}

		if (this.userLockId) {
			if (getApp().globalData.nowTTClient && this.isFollowBtn) {
				uni.showLoading({
					title: '加载中。。。'
				})
				let nowApp = await this.getLittleAppNow()
				let statusFollow = await this.getFollowCheckStatus()
				if (nowApp === 'Douyin' && !statusFollow.hasFollowed && getApp().globalData.nowTTClient) {
					this.userLock = true
				} else {
					this.userLock = false
					getApp().globalData.notSetWatchWord = true
					await this.userLockBtnClick()
					this.changeTab(this.currentIndex)
				}
				uni.hideLoading()
			} else {
				this.userLock = false
			}
		}
		this.isFollowBtn = false
		// #endif
	},
	destroyed() {
		clearInterval(this.closePopTime);
		clearInterval(this.timer);
		clearInterval(this.intervalId);
	},
	computed: {
		nowNeedLockIndex() {
			let indexNeed = 0

			for (let index = 0; index < this.videoList.length; index++) {
				let item = this.videoList[index]
				if (item.goodsLocks && item.goodsLocks.length > 0 && this.videoList[index - 1] && this.videoList[index - 1].goodsLocks.length == 0) {
					this.ksSpreaModeObj.currentLock = index
				}
			}
			return indexNeed
		},
		calHeight() {
			let tempHeight = '';
			if (this.showDramaList || this.showLock || this.showMoney) tempHeight = 'calc(100vh - 757rpx)';
			if (this.showZwyNextTheater) tempHeight = 'calc(100vh - 490rpx)';
			if (this.isOnlyAd && this.videoList[this.currentIndex] && this.videoList[this.currentIndex]['needUnLock']) tempHeight = 'calc(100vh - 532rpx)';
			console.log('tempHeight', tempHeight);
			return tempHeight;
		},
		halfVideo() {
			return this.showDramaList || this.showLock || this.showMoney || this.showZwyNextTheater;
		},
		sequenceDes(){
			let nowIndex = this.videoList.length > 0 && this.hasInit ? this.videoList[this.currentIndex]['sequence'] : -1
			return nowIndex == -1 ? '' : `第 ${nowIndex + 1} 集`
		}
	},
	async onLoad(e) {
		this.getCopyLink();
		// IAA解锁时的临时参数（每次进入播放页生成一个唯一参数用于服务端临时解锁的标识）
		if(e.iaaUnLockStr) {
			this.iaaUnLockStr = e.iaaUnLockStr
		} else {
			this.iaaUnLockStr = util.generateRandomString(8)
		}
		
		// #ifdef MP-TOUTIAO
		// 抖音信息
		let messConfig = await getLittleAppNowObj()
		let nowVerSion = messConfig.version
		this.nowAppName = messConfig.appName
		let isIos = getApp().globalData.isIos
		let versionList = [
			'22.2.1', '22.2.2', '22.2.3', '22.2.4', '22.2.0', '22.3.0', '22.3.1', '22.3.2', '22.4.0', '22.4.1', '22.4.2', '22.4.3', '22.5.0', '22.5.1', '22.5.2'
		]
		let nowVerSionArr = nowVerSion.split('.')
		//  剧多多配合测试的判断限制非抖音端支付
		if (isIos && (versionList.includes(nowVerSion) || (+nowVerSionArr[1] > 2 && +nowVerSionArr[0] > 21) || +nowVerSionArr[0] > 22 || nowVerSion === '6.6.3')) {
			this.versionView = true
		} else {
			this.versionView = false
		}
		if(e.albumId) {
			this.newVideoObj.episodeId = e.episodeId
			this.newVideoObj.albumId = e.albumId
		}
		this.$scope.isEndedNewPlayer = this.isEndedNewPlayer.bind(this)
		// #endif

		this.queryMess = e
		if (getApp().globalData.addGroupFlag) {
			this.setPlay()
		}
		let config = uni.getStorageSync('ttConfigMess')
		this.templateIds = config && config.templateIds ? config.templateIds : []
		if (e && e.enterSequence) {
			this.enterSequence = +e.enterSequence
		}
		if (e && e.batchId) {
			this.getChannelId(e.batchId)

		}
		// this.storageCurrentTime()
		// #ifdef MP-TOUTIAO
		if (e && e.batchId) {
			// this.getChannelId(e.batchId)
			this.phoneFlag = e.phoneFlag
		}

		const phoneValue = uni.getStorageSync('phoneFlag');
		if (phoneValue) {
			const showSafeguardStr = uni.getStorageSync('showSafeguard');
			if (showSafeguardStr) {
				this.safeguard = true
				this.isSafeguard = true
				this.showIcon = true
			}
		}
		// #endif
		if (e && e.batchId) {
			getApp().globalData.batchId = e.batchId
			uni.setStorageSync('bufferBatchId', e.batchId)
			this.batchIdNow = e.batchId
		}
		//判断是否广告来源
		let adPath = JSON.parse(JSON.stringify(e))
		if (e && e.callback || (adPath.ad_params && JSON.parse(adPath.ad_params) && JSON.parse(adPath.ad_params).log_extra && JSON.parse(adPath.ad_params).log_extra.clickid)) {
			getApp().globalData.callBack = true
		}
		// 生命周期内存在渠道过来的都校验广告IAA
		if (getApp().globalData.batchId) {
			this.getBatchMess(getApp().globalData.batchId)
		}

		if (e.useLastPath) {
			this.useLastPath = true;
			let tempPath = wx.getStorageSync('enterPath');
			console.log('tempPath', tempPath);
			if (tempPath) {
				tempPath = JSON.parse(tempPath);
				e = tempPath.query;
				e['userLockId'] = '';
				// 服务号链接返回友盟上报
				this.$uma && this.$uma.trackEvent('Ume_ServiceNumber', {
					name: 'Ume_SN_connectenter_app'
				});
			} else {
				this.$uma && this.$uma.trackEvent('Ume_ServiceNumber', {
					name: 'Ume_SN_connectenter_app_noId'
				});
			}
		}

		getApp().globalData.videoShow = true;
		if (e && e.batchId) {
			this.$uma && this.$uma.trackEvent('Ume_skip', {
				name: 'Ume_skip_ks_star'
			});
			getApp().globalData.batchEnter = true;
			getApp().globalData.batchId = e.batchId;
			uni.setStorageSync('batchId', e.batchId)
			this.batchIdNow = e.batchId
			let adMess = uni.getStorageSync('adMess')
			if (adMess) {
				adMess = JSON.parse(adMess)
				if(adMess.keepDate) {
					let dateAd = adMess.keepDate
					let diffTimeObj = this.timeChangeSet(new Date(), dateAd)
					console.log('diffTimeObj', diffTimeObj)
					if(diffTimeObj.minutes > 5) {
						adMess = {}
						uni.removeStorageSync('adMess')
					}
				}
			} else {
				adMess = {}
			}
			// 快手激活
			//  #ifdef MP-KUAISHOU
			setTimeout(() => {
				this.zwyRequest({
					url: '/blade/ks/init',
					method: 'POST',
					data: {
						...adMess,
						...e
					},
					noErr: true
				});
				this.postActive();
			}, 3000);
			// #endif
			// 抖音激活
			// #ifdef MP-TOUTIAO
			setTimeout(async () => {
				await this.zwyRequest({
					url: '/blade/ks/init',
					method: 'POST',
					data: {
						...adMess,
						...e
					},
					noErr: true
				});
				this.postActiveDy();
			}, 3000);
			// #endif
		}
		this.$statis({
			action: 'VISIT'
		})
		if (e.showToast) {
			uni.showToast({
				title: '内容不存在,已为您推荐其他热播短剧',
				icon: 'none',
				duration: 3000
			});
		}
		this.hasBuyObj = uni.getStorageSync('hasBuy') || {};
		for (let key in e) {
			this[key] = e[key];
		}
		setTimeout(() => {
			uni.setNavigationBarColor({
				frontColor: '#ffffff',
				backgroundColor: '#000000',
				animation: {
					duration: 400,
					timingFunc: 'easeIn'
				}
			});
		}, 500);
		var wH = await uni.getSystemInfoSync().windowHeight;
		var wW = await uni.getSystemInfoSync().windowWidth;
		if (wH / wW - 16 / 9 > 0.1) {
			var statusBarHeight = (await uni.getSystemInfoSync()['statusBarHeight']) || 20;
			var playerT = statusBarHeight;
			if (wH / wW - 16 / 9 > 0.2) {
				playerT = statusBarHeight < 40 ? 85 : statusBarHeight + 45;
			}
			this.wH = wH;
			this.wW = wW;
			this.playerT = playerT;
			this.playerH = wH - statusBarHeight - 120 + 'px';
			this.statusBarHeight = statusBarHeight;
		}

		if (e.userLockId) {
			// 存在用户关注锁
			this.userLockId = e.userLockId;
			this.userLockSequence = e.userLockSequence;
			console.log('存在用户关注锁457', this.userLockId);
		}


		// #ifdef MP-TOUTIAO
		// 关注锁相关配置
		let nowApp = await this.getLittleAppNow()
		if (nowApp === 'Douyin') {
			this.getLinkJump()
		}
		this.getDyDiversionDaoliu(6,2);
		// #endif
		
		getApp().globalData.videoBack = true;
		// setTimeout(() => {
		// 	// 未关注剧集 出现关注弹窗
		// 	// #ifdef MP-TOUTIAO
		// 	this.showType = 'chatTTpopup'; // chatTTpopup zjTTpopup
		// 	// #endif
		// 	this.$refs.zwyPopupAll.show('mid');
		// }, 1000);
	},
	async onReady(e) {
		// 判断是否从新播放器卡片进入 优先获取视频ID
		if(this.newVideoObj.albumId && this.newVideoObj.episodeId) {
			let res = await this.getFakeIdToAid(this.newVideoObj)
			this.enterSequence = res.sequence || 0
			this.fakeId = res.compilationsFakeId
		}
		// #ifdef MP-TOUTIAO
		await this.getLinkJump()
		// #endif
		this.getUserInfoMess()
		if ((!this.fakeId || this.fakeId == 'undefined') && (!this.compilationId || this.compilationId ==
			'undefined')) {
			this.noDataAndBackVideo();
			return;
		}
		Promise.all([this.getDetail(), this.getList()]).then(res => {
			// 已经解锁得集数大于存在锁的集数以存在锁的集数为主
			let firstHasLock = this.videoList.find(item => item.needUnLock) || {}
			let noLockIndex = (firstHasLock.sequence || 1) - 1
			let alreadyNum = this.compInfo['alreadyWatchSequence'] || 0
			let nowIndex = noLockIndex < alreadyNum ?  noLockIndex : alreadyNum

			console.log(nowIndex, this.isJumpNext, this.enterSequence, 'nowIndex------------------------------837')
			if (this.isJumpNext) nowIndex += 1;
			setTimeout(() => {
				if (this.enterSequence && this.enterSequence != 0 && !this.useLastPath) nowIndex = this
					.enterSequence;
				if (this.enterSequence == 0) nowIndex = 0
				if (this.compInfo['alreadyWatchSequence'] > 0 && this.useLastPath && nowIndex != 0)
					nowIndex += 1;
				if (nowIndex > this.videoList.length - 1) nowIndex = this.videoList.length - 1;
				else if (nowIndex < 0) nowIndex = 0;
				this.duration = 0;
				this.$nextTick(() => {
					this.changeTab(String(nowIndex));
					this.hasInit = true;
					setTimeout(() => {
						this.duration = 300;
						this.shareTitle();
					}, 400);
				})
			}, 166.6);
			this.videoContext = uni.createVideoContext('myVideo');
		});
	},
	methods: {
		async getDyDiversionDaoliu(num, diversionTarget) {
			// 第一个参数是导流场景：1支付前，2支付后，3首页，4播放页按钮，第二个参数是导流目标，1是加关，2是加群
			// if (getApp().globalData.dyDiverInfo6) {
			// 	this.dyDiverInfo = getApp().globalData.dyDiverInfo6;
			// 	return;
			// }
			let res = await this.zwyRequest({
				method: 'get',
				url: `/douYin/diversion?diversionScene=${num}&diversionTarget=${diversionTarget}`
			})
			console.log('getDyDiversion', res);
			if (res && res[0]) {
				getApp().globalData.dyDiverInfo6 = res[0];
				this.dyDiverInfo = res[0];
				this.$statis({
					action: 'EXPOSURE',
					position: 'DY_DIVERSION_DY_GROUP/DY_LEFT_CORNER_RETURN',
					taskId:this.dyDiverInfo.id
				})
			}else{
				getApp().globalData.dyDiverInfo6 = '';
				this.dyDiverInfo = '';
			}
		},
		async getFakeIdToAid(obj) {
			let {
				albumId,
				episodeId
			} = obj
			let res = await this.zwyRequest({
				url: `/cdp/episodic_drama/dy/drama_info?albumId=${albumId}&episodeId=${episodeId}`,
				method: 'GET'
			})
			return res
		},
		videoError(error) {
			console.log('video-err', error)
			let {
				detail
			} = error
			this.errorPopupVideo({
				videoUrl: this.videoUrl,
				...(detail || {})
			})
		},
		async getGroupLink() {
			// #ifdef MP-TOUTIAO
			// 抖音免费群口令复制（消除免费和付费的限制）
			// 群口令获取时间规则配置在前
			console.log('21121221', getApp().globalData.spreadModeBatch)
			if (
				['023009', '023010', '023011', '023011', '023016', '023015', '023014', '023030', '025001'].includes(getApp().globalData.scene) ||
				['SHORT_THEATER_PROMOTION_TIKTOK', 'SHORT_THEATER_PROMOTION'].includes(getApp().globalData.spreadModeBatch)
			) {
				console.log('getTimeSet1315',getApp().globalData.isViewOrganization);
				if (getApp().globalData.isViewOrganization) { // 非合作进来才会触发
					this.getTimeSet()
				}
			}
			// #endif

			// #ifdef MP-KUAISHOU
			// 快手群口令复制免费（挂链进来）

			if (this.queryMess && this.queryMess.ks_third_id && getApp().globalData.isViewOrganization) {

				let recordListKs = await this.getRecordList() || [] // 充值记录
				if (!(recordListKs && recordListKs.length)) { // 有充值记录的不处理
					let copyLinkTime = uni.getStorageSync('copyLinkTime')
					// 3天以内不可再复制
					if (copyLinkTime) {
						let newTime = new Date()
						let configTime = this.timeChangeSet(newTime, copyLinkTime)
						if (configTime.days && configTime.days > 3) {
							uni.removeStorageSync('copyLinkTime')
							this.getCopyLinkKs()
						}
					} else {
						this.getCopyLinkKs()
					}
				}
			} else {
				getApp().globalData.thirdIncome = false
			}
			// #endif
		},
		// 一键加群卡点逻辑
		async viewPopupQiWei() {
			let {
				isClose, // 是否可关闭
				stickingPointSequence, // 卡点集数
				buySpace, // 付费集数
				buyType, // 付费类型
				dialogRate,
				groupCombineId
			} = getApp().globalData.popupMess

			let currentIndex = this.currentIndex + 1
			let nowBuySpace = this.hasBuyNum
			if (!buyType || buyType < 1) { // 付费前
				if (isClose) { // 有弹窗频率，可关闭
					if (currentIndex === stickingPointSequence) {
						this.addGroup(groupCombineId)
					} else if (dialogRate && currentIndex > stickingPointSequence && (currentIndex - stickingPointSequence) % dialogRate === 0) {
						this.addGroup(groupCombineId)
					} else {
						this.handleClosePopup()
					}

				} else { // 不可关闭
					if (currentIndex === stickingPointSequence) {
						this.addGroup(groupCombineId)
					} else if (dialogRate && currentIndex > stickingPointSequence && (currentIndex - stickingPointSequence) % dialogRate === 0) {
						this.addGroup(groupCombineId)
					} else {
						this.handleClosePopup()
					}
				}
			} else { // 付费后
				if (isClose) { // 有弹窗频率，可关闭
					if (nowBuySpace === buySpace) {
						this.addGroup(groupCombineId)
					} else if (dialogRate && nowBuySpace > buySpace && (currentIndex - buySpace) % dialogRate === 0) {
						this.addGroup(groupCombineId)
					} else {
						this.handleClosePopup()
					}
				} else { // 不可关闭
					if (nowBuySpace === buySpace) {
						this.addGroup(groupCombineId)
					} else if (dialogRate && nowBuySpace > buySpace && (currentIndex - buySpace) % dialogRate === 0) {
						this.addGroup(groupCombineId)
					} else {
						this.handleClosePopup()
					}
				}
			}
		},
		async addGroup(id) {

			let time = Math.random()
			console.log(time, 'time------');
			try {
				if (!id) return
				let res = await this.zwyRequest({
					url: `/douYin/group_combine/group_info?groupCombineId=${id}`,
					method: 'GET',
					data: {
						resetMark: getApp().globalData.addGroupFlag ? '24379540' : time
					}
				})
				if (res) {
					console.log(getApp().globalData.addGroupFlag, 'uni.getStorageSync-----addGroupFlag');
					this.groupId = res.groupId
					if (this.groupId) {
						this.showPopup()
					}
					console.log(res.groupId, '加群------');
				}
			} catch (error) {
				console.log(error)
			}
		},
		async showPopup() {
			let { addGroupStyle, isClose } = getApp().globalData.popupMess
			this.closeFlag = isClose
			await this.$nextTick()
			this.addGroupStyle = addGroupStyle
			this.$refs.popupBox && this.$refs.popupBox.show('mid')
			if (this.addGroupStyle == 1) {
				this.sendCode()
			}
			let count = 0;
			this.closePopTime = setInterval(() => {
				count++
				if (count <= 4) {
					this.setPause()
				}
			}, 500);
		},
		async handleClosePopup() {
			clearInterval(this.closePopTime);
			this.closePopTime = null;
			await this.$nextTick()
			this.$refs.popupBox && this.$refs.popupBox.close()
			// this.$refs.zwyVideo.playNow()
			this.clearTimer();  //关闭定时器
			this.setPlay()
			setTimeout(() => {
				this.setPlay()
			}, 200)
			setTimeout(() => {
				this.setPlay()
			}, 400)
		},
		setPlay() {
			console.log('播放1111----')
			if (this.$refs.zwyVideo) {
				this.reqNum = 0
				for (let v of this.$refs.zwyVideo) {
					v.playNow()
				}
				// this.$refs.zwyVideo[this.$refs.zwyVideo.length-1].playNow()
			} else {
				if (this.reqNum < 8) {
					this.reqNum++
					this.setPlay()
				}
			}
		},
		setPause() {
			console.log('暂停1111----', this.$refs.zwyVideo)

			if (this.$refs.zwyVideo) {
				this.reqNum = 0
				for (let v of this.$refs.zwyVideo) {
					v.isPause();
				}
			} else {
				if (this.reqNum < 8) {
					this.reqNum++
					setTimeout(() => {
						this.setPause()
					}, 500)
				}
			}
		},
		handleJoinGroup(e) {
			this.handleClosePopup()
			getApp().globalData.addGroupFlag = true
			let { groupCombineId } = getApp().globalData.popupMess
			this.addGroup(groupCombineId)
			console.log(e, '回调信息')
		},
		//倒计时
		sendCode() {
			this.clearTimer();
			this.loading();  //启动定时器
			this.timer = setInterval(() => {
				//创建定时器
				if (this.countdown === 0) {
					this.countdown = '15'
					// this.clearTimer();  //关闭定时器
					// this.handleClosePopup()

				} else {
					this.loading();
				}
			}, 1000);
		},
		loading() {
			//启动定时器
			this.countdown--;  //定时器减1
		},
		clearTimer() {
			//清除定时器
			clearInterval(this.timer);
			this.timer = null;
			// this.countdown = '15'
		},
		tapMaster(e) {
			this.masterShow = e
			// #ifdef MP-KUAISHOU
			if (e) {
				this.videoPause()
			} else {
				this.videoPlay()
			}
			// #endif
			// #ifdef MP-TOUTIAO
			if (this.masterShow && this.$refs.zwyVideo) {
				console.log(this.$refs.zwyVideo)
				if (this.$refs.zwyVideo[0].currentIndex !== this.$refs.zwyVideo[0].index) {
					if (this.$refs.zwyVideo[1]) {
						this.$refs.zwyVideo[1].playNow()
						this.$refs.zwyVideo[1].isPause()
					}

				} else {
					this.$refs.zwyVideo[0].isPause()
				}

			} else {
				this.$refs.zwyVideo[0].playNow()
				if (this.$refs.zwyVideo[1]) {
					this.$refs.zwyVideo[1].playNow()
				}
			}
			// #endif
		},
		adloadhandler(e) {
			console.log("广告加载成功");
		},
		aderrorhandler(e) {
			console.log("广告加载失败", e);
			tt.showToast({
				title: "广告加载失败" + e.errMsg,
				icon: "fail",
			});
		},
		adclosehandler(e) {
			console.log("广告关闭");
		},
		handleCloseAdBtn() {
			this.interValTime && clearInterval(this.interValTime)
			// #ifdef MP-KUAISHOU
			this.$refs.addPopupBox && this.$refs.addPopupBox.close()
			if(this.isIaaAd){
				this.viewAdTime = 0
				this.showLock = true
				this.viewBox = true
				this.showMoney = false
			}
			// #endif
			// #ifdef MP-TOUTIAO
			this.$refs.addPopupBox && this.$refs.addPopupBox.close()
			if(this.isIaaAd){
				this.viewAdTime = 0
				this.noUseVideo = true
				this.showLock = true
				this.viewBox = true
				this.showMoney = false
				this.safeguard = false
			}
			// #endif
		},
		handleCloseAd() {
			this.$statis({
				action: 'CLOSE',
				position: '/position/iaa/window'
			})
			this.interValTime && clearInterval(this.interValTime)
			// #ifdef MP-KUAISHOU
			if(this.isIaaAd){
				this.viewAdTime = 0
				this.showLock = true
				this.viewBox = true
				this.showMoney = false
			}
			// 直接返回
			// this.isAdBack();
			// this.backMethodOld()
			// #endif
			// #ifdef MP-TOUTIAO
			if(this.isIaaAd){
				this.viewAdTime = 0
				this.noUseVideo = true
				this.showLock = true
				this.viewBox = true
				this.showMoney = false
				this.safeguard = false
			}
			// 直接返回
			// this.isAdBack();
			// #endif
		},
		// 广告观看完毕解锁
		closeAdBoxAndUnlock() {
			this.$refs.addPopupBox && this.$refs.addPopupBox.close()
			this.viewBox = false
			this.interValTime && clearInterval(this.interValTime)
			// #ifdef MP-TOUTIAO
			this.viewAdTime = 3
			let config = uni.getStorageSync('ttConfigMess')
			this.$statisAd({
				action: 'COMPLETE',
				adId: config.adLockId,
				adSlot: 2,
			});
			// #endif
			this.adClose(true)
		},
		// 拉起广告
		async viewAdBox() {
			let res = await this.getAdLockStatus()
			let hasNum = res.exposeAd // 是否还有次数
			if(!hasNum) {
				uni.showToast({
					title: '广告看的太多了,过会儿再来吧！',
					icon: 'none'
				})
				return 
			}
			// 次数不为0则可以拉起广告解锁
			let count = (uni.getStorageSync('adLockCount') || {}).count || 0
			console.log('观看广告成功次数', count)
			if (this.adMessAll.iaaUnlockTimes >= 0) { // 有限次
				let canViewNum = this.adMessAll.iaaUnlockTimes - count
				console.log('观看广告剩余次数', canViewNum)
				if (canViewNum > 0) {
					setTimeout(() => {
						this.$statis({
							action: 'EXPOSURE',
							position: '/position/iaa/window'
						})
						// #ifdef MP-KUAISHOU
						this.nowAdTypeKs = 'iaaAd'
						this.$refs.rewardAd && this.$refs.rewardAd.isShowAd()
						// #endif
						// #ifdef MP-TOUTIAO
						this.$refs.rewardAdTt && this.$refs.rewardAdTt.isShowAd()
						// #endif
					}, 1000);

				} else {
					// 直接返回
					this.backMethodOld()
				}
			} else { // 无限次
				uni.showLoading({
					title: '加载广告中。。。'
				})
				setTimeout(() => {
					// #ifdef MP-KUAISHOU
					this.nowAdTypeKs = 'iaaAd'
					this.$refs.rewardAd && this.$refs.rewardAd.isShowAd()
					// #endif
					// #ifdef MP-TOUTIAO
					this.$refs.rewardAdTt && this.$refs.rewardAdTt.isShowAd()
					// #endif
				}, 1000);
			}
		},
		// 获取广告配置新接口 处理广告展示逻辑
		async getBatchMess(batchId) {
			try {
				let res = await this.zwyRequest({
					method: 'get',
					url: '/cdp/launch/getMediaSpreadInfo',
					data: {
						batchId: batchId
					}
				})
				let {
					mediaAccountSpreadBatchDTO
				} = res
				// 群口令的逻辑
				console.log('mediaAccountSpreadBatchDTO',mediaAccountSpreadBatchDTO);
				if (mediaAccountSpreadBatchDTO && mediaAccountSpreadBatchDTO.spreadMode) {
					getApp().globalData.spreadModeBatch = mediaAccountSpreadBatchDTO.spreadMode || '';
					console.log('getGroupLink');
					this.getGroupLink()
				}

				if (mediaAccountSpreadBatchDTO && mediaAccountSpreadBatchDTO.spreadBatchExt && mediaAccountSpreadBatchDTO.spreadBatchExt.iaaUnlock) {
					this.isIaaAd = true
					this.adMessAll.iaaUnlockTimes = mediaAccountSpreadBatchDTO.spreadBatchExt.iaaUnlockTimes
					this.adMessAll.guideDialogSwitch = mediaAccountSpreadBatchDTO.spreadBatchExt.guideDialogSwitch
				} else {
					this.isIaaAd = false
				}
				console.log(res)
			} catch (error) {
				console.log(error)
			}
		},
		// 广告逻辑处理
		adViewSet() {
			if (this.adMessAll.guideDialogSwitch === 2) { // 可关闭
				let count = (uni.getStorageSync('adLockCount') || {}).count || 0
				console.log('观看广告成功次数1', count)
				if (this.adMessAll.iaaUnlockTimes >= 0) { // 有限次
					let canViewNum = this.adMessAll.iaaUnlockTimes - count
					console.log('观看广告剩余次数1', canViewNum)
					if (canViewNum > 0) {
						this.$statis({
							action: 'CLICK',
							position: '/position/iaa/window'
						})
						this.$refs.addPopupBox.show('mid')
						this.setTimeAll()
					} else {
						// 直接返回
						if(this.positionIaa ==='moneyPop') {
							this.positionIaa = ''
							this.showMoney = false
						} else {
							this.backMethodOld()
						}
					}
				} else { // 无限次
					this.$statis({
						action: 'CLICK',
						position: '/position/iaa/window'
					})
					this.$refs.addPopupBox.show('mid')
					this.setTimeAll()
				}
			} else { // 不可关闭
				this.viewAdBox()
			}
		},
		async viewAlertBox() {
			await this.$nextTick()
			// #ifdef MP-KUAISHOU
			console.log(this.$refs.beforeBuyAlert)
			this.$refs.beforeBuyAlert.show('mid')
			this.setViewAlertTwo = true
			// #endif
			// #ifdef MP-TOUTIAO
			console.log(this.$refs.beforeBuyAlert)
			let strCount = `beforeBuyAlert${this.currentIndex}`
			console.log(strCount)
			this.$refs.beforeBuyAlert && this.$refs.beforeBuyAlert[0] ? this.$refs.beforeBuyAlert[0].show('mid') : this.$refs.beforeBuyAlert.show('mid')
			this.setViewAlertTwo = true
			// #endif
		},
		viewAlertBoxClose() {
			// #ifdef MP-KUAISHOU
			this.$refs.beforeBuyAlert.close()
			this.setViewAlertTwo = false
			this.jumpViewLockNew()
			// #endif
			// #ifdef MP-TOUTIAO
			this.$refs.beforeBuyAlert && this.$refs.beforeBuyAlert[0] ? this.$refs.beforeBuyAlert[0].close() : this.$refs.beforeBuyAlert.close()
			this.setViewAlertTwo = false
			this.jumpViewLockNew()
			// #endif

		},
		// 跳转到第一个卡点集
		jumpViewLockNew() {
			let index = this.videoList.find(item => item.needUnLock).sequence
			this.changeTab(index)
		},
		viewAlertBuyBefore() {
			uni.showToast({
				title: '请按剧集顺序解锁观看',
				icon: 'none',
				duration: 2000
			})
		},
		dian(e) {
			console.log('dddddd')
		},
		closeksFoucs() {
			this.foucsKsPopup = !this.foucsKsPopup
		},
		joinClick(){
			this.$statis({
				action: 'CLICK',
				position: 'DY_DIVERSION_DY_GROUP/DY_LEFT_CORNER_RETURN',
				taskId:this.dyDiverInfo.id
			})
		},
		async getChannelId(batchId) {
			try {
				let res = await this.zwyRequest({
					method: 'get',
					url: '/cdp/launch/spread_info',
					data: {
						batchId: batchId
					}
				})
				if (res && res.spreadBatch) {
					getApp().globalData.spreadMode = res.spreadMode || ''
					if (res.spreadBatch.spreadMode == 'BOUND_MOBILE') {
						//#ifdef MP-TOUTIAO

						this.isShowBtnPlay = true;
						uni.setStorageSync('phoneFlag', true)
						//#endif

					}
					// #ifdef MP-KUAISHOU


					if (res.spreadBatch.spreadMode.includes('KUAISHOU_ADDED_FANS_PAY')) {
						this.ksSpreaModeObj.spreadMode = res.spreadBatch.spreadMode
						this.ksSpreaModeObj.dialogRate = res.spreadBatch.dialogRate
						this.ksSpreaModeObj.addedFansRelativePosition = res.spreadBatch.addedFansRelativePosition
						if (this.ksSpreaModeObj.spreadMode.includes('DIALOG_CLOSED')) {
							this.ksPiontIsclose = true
						} else {
							this.ksPiontIsclose = false
						}
					} else {
						this.storageCurrentTime()
					}
					// #endif

					console.log(res, '6666666666666');
				}
			} catch (error) {
				console.log(error)
			}
		},
		// 关闭弹窗
		loginClose() {
			this.isPhone = true
			wx.uma.trackEvent('Ume_video page_number_popup', {
				'Ume_number_popup_first_disagree': '播放页首次弹窗关闭'
			});

			this.safeguard = true
			this.isSafeguard = true
			this.showIcon = true
			if (this.showMoney) {
				this.safeguard = false
			}
		},
		czSuccessClose() {
			this.successFlag = false
			this.safeguard = false
		},
		getLoginMess() {
			let _this = this
			uni.login({
				success(res) {
					_this.loginJsCode = res.code
				},
				fail(error) {
					console.log(error)
				}
			})
		},
		async getPhoneNumberDouYin(e) {
			wx.uma.trackEvent('Ume_video page_number_popup', {
				'Ume_number_popup_first_agree': '播放页首次弹窗同意授权'
			});
			wx.uma.trackEvent('Ume_video page_number_popup', {
				'Ume_official_popup': '官方授权弹窗曝光'
			});
			if (this.safeguard) {
				wx.uma.trackEvent('Ume_video page_number_popup', {
					'Ume_number_icon_click': '播放页icon点击'
				});
			}
			try {
				if (!e.detail.iv) {
					uni.showToast({
						title: '授权失败！',
						icon: 'none'
					});
					wx.uma.trackEvent('Ume_video page_number_popup', {
						'Ume_official_popup_disagree': '官方授权弹窗拒绝授权'
					});
					console.log(e.detail.iv, '授权失败11111');
					if (this.successFlag) {
						this.safeguard = false
						wx.uma.trackEvent('Ume_video page_number_popup', {
							'Ume_number_popup_pay_disagree': '播放页充值后手机号授权弹窗授权拒绝'
						});
					}
					this.isPhone = true
					this.safeguard = true
					this.successFlag = false
					this.isSafeguard = true
					this.showIcon = true
					return;
				}
				let that = this
				let data = await this.zwyRequest({
					url: '/user/mobile_login/binding_dou_yin_mobile',
					method: 'PUT',
					data: {
						jsCode: this.loginJsCode,
						data: e.detail.encryptedData,
						iv: e.detail.iv
					}
				})
				console.log('data====', data)
				if (data) {
					uni.showToast({
						title: `绑定成功`,
						icon: 'none'
					})
					wx.uma.trackEvent('Ume_video page_number_popup', {
						'Ume_official_popup_agree': '官方授权弹窗同意授权'
					});
					this.isPhone = true
					if (this.successFlag) {
						wx.uma.trackEvent('Ume_video page_number_popup', {
							'Ume_number_popup_pay_agree': '播放页充值后手机号授权弹窗授权同意'
						});
						this.successFlag = false
					}
					this.safeguard = false
					setTimeout(() => {
						that.getUserInfoMess()
					}, 300)
				} else {
					console.log(data, '授权失败22222');
				}
			} catch (error) {
				console.log(error)
			}
		},
		async getUserInfoMess() {
			try {
				let res = await this.zwyRequest({
					url: `/user/login_user/info`,
					method: 'GET',
					params: {
						isUser: true
					}
				})

				if (res && res.mobile) {
					this.isPhone = true
					this.isSafeguard = false
				} else {
					this.isPhone = false
					this.isSafeguard = true
					wx.uma.trackEvent('Ume_video page_number_popup', {
						'Ume_number_popup_first': '播放页首次弹窗曝光'
					});
				}
			} catch (error) {
				console.log(error)
			}
		},
		async getUserInfoMess1() {
			try {
				let res = await this.zwyRequest({
					url: `/user/login_user/info`,
					method: 'GET',
					params: {
						isUser: true
					}
				})
				if (res && res.mobile) {
					// this.isPhone = true
					this.isSafeguard = false
				} else {
					// this.isPhone = false
					this.isSafeguard = true
					wx.uma.trackEvent('Ume_video page_number_popup', {
						'Ume_number_popup_first': '播放页首次弹窗曝光'
					});
				}
			} catch (error) {
				console.log(error)
			}
		},
		//
		videoTouchStart(e) {
			this.moveObj.clientY = e.changedTouches[0].clientY
		},
		videoTouchMove(e) {
			if (this.showDramaList) return
			let touchObj = e.touches[0]
			this.endMoveObj.clientY = touchObj.clientY
			let distanceObj = touchObj.clientY - this.moveObj.clientY
			let num = 0
			if (touchObj.clientY > this.moveObj.clientY) { // 向下移动上一集切换
				if (distanceObj < this.scopeDis) {
					num = distanceObj
				} else {
					num = this.scopeDis
				}
			}

			if (touchObj.clientY < this.moveObj.clientY) { // 向上移动下一集切换
				if (distanceObj > -this.scopeDis) {
					num = distanceObj
				} else {
					num = -this.scopeDis
				}
			}

			this.moveY = num
			console.log(this.moveY)
		},
		videoTouchEnd(e) {
			if (this.moveObj.clientY === 0 || this.endMoveObj.clientY === 0) {
				return
			}
			let distanceObj = this.endMoveObj.clientY - this.moveObj.clientY
			if (this.endMoveObj.clientY > this.moveObj.clientY) { // 向下移动上一集切换
				if (distanceObj >= this.scopeDis) {
					console.log('上一集切换')
					this.isLast()
					this.moveObj.clientY = 0
					this.endMoveObj.clientY = 0
				}
			}

			if (this.endMoveObj.clientY < this.moveObj.clientY) { // 向上移动下一集切换
				if (distanceObj < -this.scopeDis) {
					console.log('下一集切换')
					this.isNext()
					this.moveObj.clientY = 0
					this.endMoveObj.clientY = 0
				}
			}
			// 检查当前剧是否是IAA
			console.log('this.videoList', this.videoList)
			if(this.videoList && this.videoList.length) {
				this.isIaaAd = this.videoList.some(item => item.isIaa)
				console.log('this.isIaaAd', this.isIaaAd)
				this.checkAddIaaMess()
			}
			// 清除距离记录
			this.moveY = 0
			this.endMoveObj = {}
			this.moveObj = {}
		},
		// 时间对比
		timeChangeSet(time, afterTime) {
			const text = {}
			if (!time || !afterTime) return text
			const newTime = new Date(time)
			const oldTime = new Date(afterTime)
			const diffTime = (newTime - oldTime) / 1000

			const days = parseInt(diffTime / 86400)
			const hours = parseInt(diffTime / 3600) - 24 * days
			const minutes = parseInt(diffTime % 3600 / 60)
			const seconds = parseInt(diffTime % 3600 % 60)
			return {
				diffTime,
				days,
				hours,
				minutes,
				seconds
			}
		},
		// 获取对应小程序时间规则配置
		async getTimeSet() {
			try {
				let timeObj = await this.zwyRequest({
					url: `/welfare/word/getWordDayRule`,
					method: 'GET'
				})
				console.log('timeObj=------', timeObj)
				let copyLinkTime = uni.getStorageSync('copyLinkTime')
				// 3天以内不可再复制
				if (copyLinkTime) {
					let newTime = new Date()
					let configTime = this.timeChangeSet(newTime, copyLinkTime)
					console.log('getTimeSet3天以内不可再复制',configTime);
					if (configTime.days && configTime.days > timeObj) {
						console.log('getTimeSet 时间到了 清空时间')
						uni.removeStorageSync('copyLinkTime')
						this.getCopyLink()
					}
				} else {
					console.log('getTimeSet 获取小程序配置信息(抖音)')
					this.getCopyLink()
				}
			} catch (error) {
				console.log(error)
			}
		},
		// 获取小程序配置信息(抖音)
		async getCopyLink() {
			console.log('getCopyLink');
			try {
				let res = await this.getConfigDouyin();
				console.log('getCopyLink',res);
				let useDepartment = 0 // 0:私域运营的 1：短视频运营的
				if (['023009', '023010', '023011', '023012', '023012', '027004', '027005'].includes(getApp().globalData.scene) || ['SHORT_THEATER_PROMOTION_TIKTOK', 'SHORT_THEATER_PROMOTION'].includes(getApp().globalData.spreadModeBatch)) {
					useDepartment = 1
				} else {
					useDepartment = 0
				}
				let wardObj = await this.getWardConfig(0, 0, useDepartment)
				this.copyGroupLinkBefore = wardObj.content || ''
				this.copyGroupLinkBeforeId = wardObj.id || ''
				let copyLinkStatus = res.copyLinkStatus
				this.copyLinkStatus = copyLinkStatus
				console.log('copyGroupLinkBefore-----', this.copyGroupLinkBefore)
				// copy抖音群链接
				if (copyLinkStatus && this.copyGroupLinkBefore) {
					uni.setStorageSync('copyLinkTime', new Date())
					this.copyWatchword(this.copyGroupLinkBefore)
					this.canCopyGroupLink = true
				}
			} catch (error) {
				console.log(error)
			}
		},
		// 获取小程序配置信息(快手)
		async getCopyLinkKs() {
			try {
				getApp().globalData.thirdIncome = true
				let res = await this.getConfigKs()
				this.copyGroupLinkBefore = res.copyGroupLinkBefore
				this.copyGroupLink = res.copyGroupLink
				let copyLinkStatus = res.copyLinkStatus
				this.copyLinkStatus = copyLinkStatus
				let copyGroupLinkBefore = res.copyGroupLinkBefore
				console.log('copyGroupLinkBefore-----', res)
				// 拷贝免费群口令
				if (copyLinkStatus) {
					uni.setStorageSync('copyLinkTime', new Date())
					this.copyWatchword(copyGroupLinkBefore)
				}
			} catch (error) {
				console.log(error)
			}
		},
		handleViewBoxSet(val) {
			console.log('122121----', val)
			this.viewBox = val
		},
		showKbActivity: util.throttle(async function (type = 'nomal') {
			// 回传上报
			//#ifdef MP-KUAISHOU
			this.postActive('order')
			//#endif
			uni.showLoading({
				title: '加载中'
			});
			this.isKbActivity = true;
			let postData = '',
				url = '';
			
			postData = {
				"activityPayId": this.configRes.backKbId || 'CPS_TOP_UP_ACTIVITY_5348',
				moneyFen: 990,
				"payUse": 'FOR_MEMBERSHIP',
				useId: 3
			};
			url = '/wealth/api/pay_client/top_up_preorder';
			let header = {
				'content-type': 'application/json;charset=UTF-8',
				'episodic-drama-id': '0',
				'compilations-id': '0'
			}
			if (this.versionView) {
				header['ios-pay-version'] = true
			} else {
				header['ios-pay-version'] = false
			}
			this.zwyRequest({
				header,
				method: 'post',
				url: url,
				data: postData
			}).then(res => {
				uni.hideLoading();
				console.log('moneyClick', res);
				//#ifdef MP-KUAISHOU
				this.ksPayKb(res);
				//#endif
				//#ifdef MP-TOUTIAO
				this.ttPayKb(res);
				//#endif
			});
			console.log('type', type);
			if (type == 'first') {
				this.$uma && this.$uma.trackEvent('Ume_pay_activity', {
					name: 'Ume_pay_activity_click'
				})
			} else if (type == 'rightUse') {
				this.$uma && this.$uma.trackEvent('Ume_pay_activitykeep', {
					name: 'Ume_pay_activitykeep_getclick'
				})
			} else if (type == 'five') {
				this.$uma && this.$uma.trackEvent('Ume_pay_activitykeep', {
					name: 'Ume_pay_activitykeep_saleclick'
				})
			} else if (type == 'rightUseAfter') {
				this.$uma && this.$uma.trackEvent('Ume_pay_activitykeep', {
					name: 'Ume_pay_activitykeep_getclick'
				})
			}
		}, 2000),
		ksPayKb(res) {
			if (res) {
				this.orderInfo = res;
				let orderInfo = {
					order_no: res.kuaiShouApi.orderNo,
					order_info_token: res.kuaiShouApi.orderInfoToken
				};
				ks.pay({
					serviceId: '1',
					orderInfo: orderInfo,
					success: resPay => {
						this.getOrderInfo(res.orderId);
					},
					fail: res => {
						console.log('fail', res);
						this.noUseVideo = false;
					}
				});
			}
		},
		ttPayKb(res) {
			if (res) {
				if(res.touTiaoGeneralPayApi) { // 通用支付
					this.payMessSsVipNew(res)
				} else {
					this.orderInfo = res;
					let orderInfo = {
						order_id: res.touTiaoApi.orderId,
						order_token: res.touTiaoApi.orderToken
					};
					uni.pay({
						service: 5,
						orderInfo: orderInfo,
						success: resPay => {
							this.getOrderInfo(res.orderId);
						},
						fail: res => {
							console.log('fail', res);
							this.noUseVideo = false;
						}
					});
				}
			}
		},
		getOrderInfo(orderId) {
			this.zwyRequest({
				header: {
					'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
				},
				method: 'post',
				url: `/wealth/api/pay_order/done?orderId=${orderId}`,
				data: { orderId: orderId }
			}).then(res => {
				console.log('getOrderInfo', res);
				// this.getBalance();
				if (res && res.payStatus == 'BE_READY') {
					uni.showToast({
						title: '充值成功',
						icon: 'none'
					});
					//#ifdef MP-TOUTIAO
					tt.showFavoriteGuide({
						type: "bar",
						content: "一键添加到「我的小程序」",
						position: "bottom",
						success(res) {
							console.log("引导组件展示成功", res);
						},
						fail(err) {
							console.log("引导组件展示失败", err);
						},
					});
					//#endif
					this.noUseVideo = false;
					this.$refs.zwyPopupAll.closeNoAni();
				}
			});
		},
		czPopupCloseAfter() {
			this.$refs.zwyPopupAll.closeNoAni();
			this.isBack();
			this.$uma && this.$uma.trackEvent('Ume_pay_activitykeep', {
				name: 'Ume_pay_activitykeep_close'
			})
		},
		czPopupClose: util.throttle(function () {
			this.$refs.zwyPopupAll.closeNoAni();
			setTimeout(() => {
				//#ifdef MP-KUAISHOU
				this.showType = 'czTTpopupAfterKS';
				//#endif

				//#ifdef MP-TOUTIAO
				this.showType = 'czTTpopupAfter';
				//#endif

				this.$refs.zwyPopupAll.show('mid');

				this.$uma && this.$uma.trackEvent('Ume_pay_activity', {
					name: 'Ume_pay_activity_close'
				})

				this.$uma && this.$uma.trackEvent('Ume_pay_activity_keep', {
					name: 'Ume_pay_activity_keep_show'
				})

			}, 100)
		}, 1000),
		timeFinish(e) {
			console.log('timeFinish', e);
			this.isTime = -1;
		},
		isSameDay(startTime, endTime) {
			const startTimeMs = new Date(startTime).setHours(0, 0, 0, 0);
			const endTimeMs = new Date(endTime).setHours(0, 0, 0, 0);
			return startTimeMs === endTimeMs ? true : false
		},
		async topBack(type) {
			console.log('广告参数', this.showAd, this.isIaaAd)
			let isCheckGroup = false
			// #ifdef MP-KUAISHOU
			isCheckGroup = !!(this.showAd && this.isIaaAd)
			// #endif
			// #ifdef MP-TOUTIAO
			isCheckGroup = !!(this.showAd && this.isIaaAd)
			// #endif
			// 统一处理激励广告展示的逻辑
			let status = (!this.alreadyClick && type === 'leftTop') || !type
			if (isCheckGroup && status) {
				if(type === 'leftTop') {
					this.viewAdTime = 3
					this.alreadyClick = true
				}
				let adLockCountMess = uni.getStorageSync('adLockCount') || {}
				let sameDay = false
				if (adLockCountMess && adLockCountMess.date) {
					let nowDay = new Date()
					sameDay = this.isSameDay(adLockCountMess.date, nowDay)
				}
				// 判断存储的是否是同一天不是同一天清除存储
				console.log('是否是同一天', sameDay)
				if (sameDay) {
					this.adViewSet()
				} else {
					uni.removeStorageSync('adLockCount')
					this.adViewSet()
				}
			} else {
				this.backMethodOld()
			}
		},
		async backMethodOld() {
			// #ifdef MP-KUAISHOU
			this.configRes = await this.getConfig();
			// #endif
			// #ifdef MP-TOUTIAO
			const phoneValue = uni.getStorageSync('phoneFlag');
			if (phoneValue) {
				uni.setStorageSync('showSafeguard', true)
			}
			this.configRes = await this.getConfigDouyin();
			// #endif
			let nowLockList = this.videoList[this.currentIndex]['goodsLocks'];
			let nowLockConfig = this.videoList[this.currentIndex]
			let tempIndex = nowLockList.findIndex(item => item.releaseWay == 'FRUIT_PAY');
			console.log('tempIndex', tempIndex);

			//#ifdef MP-TOUTIAO
			if (getApp().globalData.isIos) {
				tempIndex = -1;
			}
			//#endif
			// let recordList = await this.getRecordList() || [] // 充值记录
			let isSsVip = getApp().checkMemberSsVip() // 是否是大会员
			if (!uni.getStorageSync('hasShowKb') && this.configRes && this.configRes.canUseBackKb && (tempIndex != -1 && nowLockConfig.needUnLock) && !isSsVip) {
				uni.setStorageSync('hasShowKb', true);
				this.isTime = new Date().getTime() + 3 * 60 * 1000;

				// #ifdef MP-KUAISHOU
				this.showType = 'czKSpopup';
				// #endif
				// #ifdef MP-TOUTIAO
				this.showType = 'czTTpopup';
				// #endif

				this.$refs.zwyPopupAll.show('mid');

				this.$uma && this.$uma.trackEvent('Ume_pay_activity', {
					name: 'Ume_pay_activity_show'
				})

				return;
			}
			if (!this.compInfo.subscribe) {
				// 未关注剧集 出现关注弹窗
				// #ifdef MP-TOUTIAO
				this.showType = 'zjTTpopup';
				// #endif
				// #ifdef MP-KUAISHOU
				this.showType = 'zjKSpopup';
				this.noUseVideo = true;
				//#endif
				this.$refs.zwyPopupAll.show('mid');
			} else {
				// 直接返回
				if(this.dyDiverInfo && this.dyDiverInfo.groupId){
					// 如果存在群聊ID 则展示群聊弹窗。
					// #ifdef MP-TOUTIAO
					// 客户端为抖音
					this.showType = 'chatTTpopup';
					this.$refs.zwyPopupAll.show('mid');
					return;
					// #endif
					// #ifdef MP-KUAISHOU
						// 客户端为快手
					//#endif
					
				}
				
				this.isBack();
			}
		},
		async handleClosePopupTT() {
			this.isShowUserLock = false
			await this.userLockBtnClick()
			this.changeTab(this.currentIndex)
		},
		// 点击立即关注的状态
		followBtnStatus(status) {
			this.isFollowBtn = status
		},
		//获取抖音卡点参数和口令
		async getLinkJump() {
			try {
				if (!this.batchIdNow) return
				let res = await this.zwyRequest({
					method: 'get',
					url: `/cdp/launch/getQueryParamsByBatchId?batchId=${getApp().globalData.batchId}`
				})
				console.log('dasdasdsad=====', res)
				let {
					fakeId,
					buySpace,
					enterSequence,
					userLockSequence,
					watchword,
					userLockId
				} = res
				// 通过批次获取播放ID
				let sceneNow = `${getApp().globalData.nowScene}`
				console.log('sceneNow---------------', sceneNow)
				// '990001'
				if (['013001', '014001', '014002', '014003', '014004', '014005', '014006', '014007', '014009'].includes(sceneNow)) {
					console.log('符合场景值', fakeId)
					this.fakeId = fakeId
				}

				if (getApp().globalData.nowTTClient && userLockId) {
					this.userLockId = userLockId || '81858331836'
					this.userLockSequence = userLockSequence >= 0 ? userLockSequence : -1
					this.watchword = watchword || '关注'
				} else {
					this.userLockId = ''
				}
				this.buySpace = buySpace
				//拿到要进入的集数enterSequence
				this.enterSequence = enterSequence
				if (getApp().globalData.nowTTClient && !getApp().globalData.copyFirst && userLockId) {
					getApp().globalData.copyFirst = true
					this.copyWatchword(watchword)
				}
			} catch (error) {
				console.log(error)
			}
		},
		copyWatchword(val) {
			// 群口令曝光
			this.$uma && this.$uma.trackEvent('Ume_password', {
				name: 'Ume_password_Internet_celebrity_PV'
			});
			uni.setClipboardData({
				data: val,
				success: () => {
					this.$uma && this.$uma.trackEvent('Ume_password', {
						name: 'Ume_password_Ic_copy_win'
					});
				},
				fail: () => {
					this.$uma && this.$uma.trackEvent('Ume_password', {
						name: 'Ume_password_Ic_copy_Defeat'
					});
				}
			});
		},
		async userLockBtnClick() {
			if (this.userLockId) {
				this.userLock = false;
				this.userLockSequence = -1;
				this.userLockId = '';
				this.showLock = false;
				this.$uma && this.$uma.trackEvent('Ume_ServiceNumber', {
					name: 'Ume_SN_connectenter_app_click'
				});
				this.userLockBtnHasClickSeq = this.currentIndex;
				uni.setStorageSync('userLockBtnClick', true);
				await this.getList();
				await this.getVideoDetail()
			}
		},
		hideBars() {
			this.isHideBars = true
		},

		async dbClick(e) {
			console.log(e)
			this.imageArr.push({ x: e.detail, y: e.detail })
			// :style="[{ left:item.x + 'rpx', top:item.y + 'rpx' }]"
			setTimeout(() => {
				this.imageArr.shift()
			}, 2000)
			console.log(this.videoInfoList[this.currentIndex].alreadyFavorite, 'this.videoInfoList[this.currentIndex]');
			if (this.videoInfoList[this.currentIndex].alreadyFavorite == 0) {
				this.$refs.videoSidebar.dblClick()
			}
			// #ifdef MP-TOUTIAO
			// this.handleAddMess()
			// #endif

		},

		videoClick() {
			this.isHideBars = !this.isHideBars;
			this.videoZan = false

			console.log('videoClickvideoClickvideoClickvideoClick', this.isHideBars);
		},
		swiperClick() {
			this.needHideChoose = !this.needHideChoose;
		},
		showCz() {
			this.noUseVideo = true;
			this.showMoney = true;
			this.safeguard = false
		},
		showGz(){
			this.pauseNum = 1
		},
		cancelGz(){
			this.pauseNum = 0
			console.log(this.pauseNum,'this.pauseNum------this.pauseNum------000000000000000000000000000');
		},
		noDataAndBackVideo() {
			console.log('noDataAndBackVideo', this.fakeId);
			let fakeId = this.fakeId;
			if (!fakeId || fakeId == 'undefined') {
				// this.noDataAndBack();
				// return;
				fakeId = 'Pm2z';
			}
			this.zwyRequest({
				method: 'get',
				url: `/cdp/compilations/was_over/v2/next_theater/${fakeId}?enableDouYinAd=true`
				// url: '/cdp/compilations/was_over/v2/next_theater/' + fakeId
			})
				.then(res => {
					console.log('noDataAndBack', res);
					if (res && res.id) {
						let tempPath = '/pages/video/video?compilationId=' + res.id + '&fakeId=' + res.fakeId;
						if (!this.useLastPath) tempPath += '&showToast=true';
						uni.redirectTo({
							url: tempPath
						});
					} else {
						this.noDataAndBack();
					}
				})
				.catch(res => {
					this.noDataAndBack();
				});
		},
		onlyLockAd() {
			this.isOnlyAd = true;
		},
		nextTheaterClose() {
			this.showZwyNextTheater = false;
		},
		isFinish() {
			this.showZwyNextTheater = true;
		},
		isAdLockEpisodic() {
			if (this.$refs.lockPopup) {
				this.$refs.zwyPopupAll.close('none');
				this.$refs.lockPopup.lockEpisodicClick();
			}
		},
		isAdLockCompilations() {
			if (this.$refs.lockPopup) {
				this.$refs.zwyPopupAll.close('none');
				this.$refs.lockPopup.lockCompilationsClick();
			}
		},
		async isZj(type) {

			// #ifdef MP-TOUTIAO
			let appId = uni.getStorageSync('appId') || '';
			if (appId) {
				let idsObj = {
					'tt8032f68f1f0ba85501': [
						'MSG127945641c9befe1cbe0be04995d9fb7f9bd99315721', // 剧集更新提醒
						'MSG1279456d8f91eb701102666783f5525f53793e915722' // 热播新剧提醒
					],
					'tt58602eddc7597c0c01': [
						'MSG128049141c9befe1cbe0be04995d9fb7f9bd99315721',
						'MSG1280491d8f91eb701102666783f5525f53793e915722'
					],
					'ttce10b8ad512e3bd801': [
						'MSG133332741c9befe1cbe0be04995d9fb7f9bd99315721',
						'MSG1333327d8f91eb701102666783f5525f53793e915722'
					],
					'tt201256afbf2c297e01': [
						'MSG135265741c9befe1cbe0be04995d9fb7f9bd99315721', // 剧集更新提醒
						'MSG1352657d8f91eb701102666783f5525f53793e915722' // 热播新剧提醒
					],
					'tt42d2346fddec4c8401': [
						'MSG135265741c9befe1cbe0be04995d9fb7f9bd99315721', // 剧集更新提醒
						'MSG1352657d8f91eb701102666783f5525f53793e915722' // 热播新剧提醒
					],
					'ttcc83ba3e53bd20c801': [
						'MSG132756441c9befe1cbe0be04995d9fb7f9bd99315721', // 剧集更新提醒
						'MSG1327564d8f91eb701102666783f5525f53793e915722' // 热播新剧提醒
					],
					'ttab45ddf8347bb6f601': [
						'MSG13558286eee0f0a5bfb0e21e6275799a55ab65715721', // 剧集更新提醒
						'MSG1355828d8f91eb701102666783f5525f53793e915722' // 热播新剧提醒
					],
					'tt4acd3c70d5f3028301': [
						'MSG136954541c9befe1cbe0be04995d9fb7f9bd99315721', // 剧集更新提醒
						'MSG1369545598b866f34c333517280672bf81a6fe315722' // 热播新剧提醒
					]
				}
				let tmplIdsList = idsObj[appId];
				let dingyueRes = await uni.requestSubscribeMessage({
					tmplIds: tmplIdsList
				})
				console.log('dingyueRes', dingyueRes);
				let template = [];
				if (dingyueRes[1] && dingyueRes[1][tmplIdsList[0]] === 'accept') { // 剧集更新类型
					template.push({
						templateId: tmplIdsList[0],
						templateType: 1
					})
				}
				if (dingyueRes[1] && dingyueRes[1][tmplIdsList[1]] === 'accept') { // 热播新剧提醒类型
					template.push({
						templateId: tmplIdsList[1],
						templateType: 2
					})
				}
				console.log('template', template);
				if (template.length > 0) this.addDingMessTT(template);
			}
			// #endif

			//  #ifdef MP-KUAISHOU
			if (getApp().globalData.extConfig['subscribeId4'] || getApp().globalData.extConfig['subscribeId5'] || getApp().globalData.extConfig['subscribeId6']) {
				let res = await uni.requestSubscribeMessage({
					tmplIds: [getApp().globalData.extConfig['subscribeId4'], getApp().globalData.extConfig['subscribeId5'], getApp().globalData.extConfig['subscribeId6']]
				})
				this.addDingMess()
			}
			// #endif


			this.zwyRequest({
				header: {
					'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
				},
				url: '/cdp/compilations/subscribe',
				data: {
					id: this.compInfo.id
				},
				method: 'POST'
			}).then(res => {
				if (type != 'back') {
					uni.showToast({
						title: '追剧成功',
						icon: 'none'
					});
				}
				this.zjClick();
			});
			if (type == 'back') this.isBack();
		},
		// 订阅上报
		async addDingMess() {
			try {
				if (getApp().globalData.extConfig['subscribeId4'] || getApp().globalData.extConfig['subscribeId5'] || getApp().globalData.extConfig['subscribeId6']) {
					await this.zwyRequest({
						url: '/mp-api/user_one_time_subscribe/batch',
						method: 'POST',
						data: {
							sourceType: 3,
							sourceId: 0,
							sourceDesc: '',
							templates: [{
								templateId: getApp().globalData.extConfig['subscribeId6'],
								templateType: 0
							},
							{
								templateId: getApp().globalData.extConfig['subscribeId4'],
								templateType: 1
							},
							{
								templateId: getApp().globalData.extConfig['subscribeId5'],
								templateType: 2
							}
							]
						}
					})
				}
			} catch (error) {
				console.log(error)
			}
		},
		// 订阅上报
		async addDingMessTT(template) {
			try {
				let res = await this.zwyRequest({
					url: '/mp-api/user_one_time_subscribe/batch',
					method: 'POST',
					data: {
						sourceType: 3,
						sourceId: 0,
						sourceDesc: '',
						templates: template
					}
				})
				console.log('dasdddddd=====', res)
			} catch (error) {
				console.log(error)
			}
		},
		isAdBack() {
			console.log(this.currentIndex, 'this.currentIndex----');
			console.log(this.fakeId, 'this.fakeId----');
			console.log(this.compilationId, 'this.compilationId----');

			this.$uma.trackEvent('Ume_page2_control', {
				name: 'adBack'
			});
			getApp().globalData.videoShow = false;
			this.zwyRouter(`/pages/video/video?fakeId=${this.fakeId}&compilationId=${this.compilationId}&enterSequence=${this.currentIndex - 1}`);
		},
		isBack() {
			console.log('isBack2742');
			this.$uma && this.$uma.trackEvent('Ume_page2_control', {
				name: 'adBack'
			});
			getApp().globalData.videoShow = false;
			let pages = getCurrentPages(); //获取加载的页面
			if (pages.length <= 1) {
				uni.switchTab({
					url: '/pages/fx_xjc/fx_xjc'
				});
				return;
			}
			uni.navigateBack();
		},
		adFail() {
			console.log('广告加载失败了');
			this.btnType = getApp().globalData.btnType;
			this.showType = 'adFail';
			this.$refs.zwyPopupAll.show('mid');

			this.$uma && this.$uma.trackEvent('Ume_advertisement', {
				Ume_adv_Popup_defeated: '广告拉取失败弹窗曝光'
			});
			this.$uma && this.$uma.trackEvent('Ume_advertisement', {
				Ume_adv_defeated_ex: '广告解锁失败前已经曝光过的广告次数' + getApp().globalData.adHasSee
			});
		},
		adClose(end) {
			if (end) {
				if(this.isIaaAd) {
					let count = (uni.getStorageSync('adLockCount') || {}).count || 0
					count++
					uni.setStorageSync('adLockCount', {
						count: count,
						date: new Date()
					})
				}
				this.adHasFinish();
			}
		},
		adHasFinish() {
			let nowVideoObj = this.videoList[this.currentIndex]
			let tempUrl = `/cdp/payment/ads_unlock/episodic_drama/${nowVideoObj.id}`;
			let lockId = (nowVideoObj['goodsLocks'].find(item => item.releaseWay == 'WATCH_THE_ADS') || {}).id || ''

			let obj = {
				lockId: lockId
			}
			// IAA临时ID
			if(this.iaaUnLockStr) {
				obj.ticket = this.iaaUnLockStr
			}
			this.zwyRequest({
				url: tempUrl,
				data: obj,
				header: {
					'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
				},
				method: 'post'
			}).then(res => {
				console.log('购买逻辑isBuy', res);
				if (res) {
					this.noUseVideo = false;
					this.showAd = false
					this.closeAllPopup();
					this.buyoneAd('广告解锁成功');
					setTimeout(() => {
						this.getVideoDetail();
					}, 100);
				}
			});
		},
		async lockAdsClick(index) {
			this.nowGoodsLock = this.videoList[this.currentIndex]['goodsLocks'][index];
			// #ifdef MP-KUAISHOU
			this.nowAdTypeKs = 'videoAd'
			await this.$nextTick()
			if (this.isIaaAd) {
				this.$refs.rewardAd && this.$refs.rewardAd.isShowAd()
			} else {
				this.$refs.rewardAdKsFree && this.$refs.rewardAdKsFree.isShowAd()
			}
			// #endif
			// #ifdef MP-TOUTIAO
			console.log(this.isIaaAd, 'this.isIaaAd');
			let res = await this.getAdLockStatus()
			let hasNum = res.exposeAd // 是否还有次数
			if(hasNum) {
				if (this.isIaaAd) {
					this.$refs.rewardAdTt && this.$refs.rewardAdTt.isShowAd()
				} else {
					this.$refs.rewardAdTtFree && this.$refs.rewardAdTtFree.isShowAd()
				}
			} else {
				uni.showToast({
					title: '广告看的太多了,过会儿再来吧！',
					icon: 'none'
				})
			}
			// #endif
			console.log('展示广告');
		},
		titleSure() {
			this.noUseVideo = false;
			this.$refs.zwyPopupAll.close('mid');
		},
		titleChooseIndex(index) {
			this.titleIndex = index;
		},
		chooseTitle() {
			this.showType = 'chooseTitle'; //EPISODIC_DRAMA COMPILATIONS
			this.noUseVideo = true;
			this.$refs.zwyPopupAll.show('mid');
		},
		videoPlay() {
			console.log('videoPlay');
			if (!this.videoContent) this.videoContent = uni.createVideoContext('myVideo');
			this.videoContent.play();
		},
		videoPause() {
			console.log('videoPause');
			if (!this.videoContent) this.videoContent = uni.createVideoContext('myVideo');
			this.videoContent.pause();
		},
		isPause() {
			this.isShowBtnPlay = true;
		},
		shareTitle() {
			// && !getApp().globalData.batchEnter
			//  #ifdef MP-KUAISHOU
			if ((getApp().globalData.shareBatchId && getApp().globalData.sceneCheck) || getApp().globalData.needDarenChoose) {
				this.zwyRequest({
					method: 'get',
					url: `/cdp/spread_material/expert_share/${this.compInfo.id}`
				}).then(res => {
					console.log('shareTitle', res);
					if (res) {
						this.shareList = res.concat([{
							custom: true,
							guideWords: ''
						}]);
					}
				});
			} else {
				this.shareList = [];
			}
			// #endif
			//  #ifdef MP-TOUTIAO
			if (getApp().globalData.shareBatchId || getApp().globalData.needDarenChoose) {
				this.zwyRequest({
					method: 'get',
					url: `/cdp/spread_material/expert_share/${this.compInfo.id}`
				}).then(res => {
					console.log('shareTitle', res);
					if (res) {
						this.shareList = res.concat([{
							custom: true,
							guideWords: ''
						}]);
					}
				});
			} else {
				this.shareList = [];
			}
			// #endif
		},
		isTouchMove(e) {
			console.log('isTouchMove', e);
		},
		likeClick() {
			let tempList = JSON.parse(JSON.stringify(this.videoInfoList));
			if (tempList[this.currentIndex]['alreadyFavorite'] == 1) {
				tempList[this.currentIndex]['alreadyFavorite'] = 0;
				tempList[this.currentIndex]['favoriteNum']--;
			} else {
				tempList[this.currentIndex]['alreadyFavorite'] = 1;
				tempList[this.currentIndex]['favoriteNum']++;
			}
			this.videoInfoList = JSON.parse(JSON.stringify(tempList));
		},
		isShare() {
			let tempList = JSON.parse(JSON.stringify(this.videoInfoList));
			tempList[this.currentIndex]['shareNum']++;
			this.videoInfoList = JSON.parse(JSON.stringify(tempList));
		},
		zjClick() {
			let tempcompInfo = JSON.parse(JSON.stringify(this.compInfo));
			tempcompInfo['subscribe'] = true;
			this.compInfo = JSON.parse(JSON.stringify(tempcompInfo));
		},
		isVideoClick() {
			console.log('isVideoClick');
		},
		anFinish(e) {
			console.log('anFinish', e);
			let nowIndex = e.detail.current;
			//#ifdef MP-TOUTIAO
			// 拷贝群口令
			if (this.canCopyGroupLink && this.copyGroupLinkBefore) {
				// this.copyWatchword(this.copyGroupLinkBefore)
				// 上报后台
				if (this.copyGroupLinkBefore) {
					this.callBackWardCopy(this.copyGroupLinkBeforeId)
				}
				this.copyGroupLinkBefore = ''
				this.canCopyGroupLink = false
			}
			//#endif

			// 检查当前剧是否是IAA
			if(this.videoList && this.videoList.length) {
				this.isIaaAd = this.videoList.some(item => item.isIaa)
				this.checkAddIaaMess()
			}
			if (e.detail.source == 'touch' && nowIndex != this.currentIndex) {
				// this.currentIndex = nowIndex;
				this.changeTab(nowIndex);
			}
		},
		swiperChange(e) {
			console.log('swiperChange', e);
			// if (e.detail.source == 'touch') {
			// let nowIndex = e.detail.current + 1;
			// this.currentIndex = nowIndex;
			// console.log(this.currentIndex,'this.currentIndex---');
			// 	this.changeTab(nowIndex);
			// }
		},
		getShowType() {
			let tempLocks = this.compInfo.goodsLocks;
			for (let i = 0; i < tempLocks.length; i++) {
				if (tempLocks[i]['goodsType'] == 'COMPILATIONS') {
					this.nowGoodsLock = tempLocks[i];
					return 'COMPILATIONS';
				}
			}
			return 'EPISODIC_DRAMA';
		},
		popupIsClose() {
			this.noUseVideo = false;
		},
		rightUse(type) {
			this.$refs.zwyPopupAll.close();
			this.noUseVideo = true;
			if (type == 'EPISODIC_DRAMA') {
				// 剧集立即使用
				this.showMoney = true;
				this.safeguard = false
			} else if (type == 'COMPILATIONS') {
				// 合集立即使用
				this.isPay();
			}
		},
		popupClose() {
			this.$refs.zwyPopupAll.close();
		},
		async czSuccess(val) {
			this.noUseVideo = false;
			this.showMoney = false;
			//#ifdef MP-TOUTIAO
			const phoneValue = uni.getStorageSync('phoneFlag');
			if (phoneValue) {
				this.getUserInfoMess()
				this.successFlag = true
				this.showLogin = false
				uni.setStorageSync('showLogin', this.showLogin)
				console.log(this.isPhone, this.successFlag, this.showLogin, '充值测试');
				wx.uma.trackEvent('Ume_video page_number_popup', {
					'Ume_number_popup_pay': '播放页充值后手机号授权弹窗曝光'
				});
				this.safeguard = false
			}

			//#endif
			this.getBalance()
			this.viewBox = true
			if (val && val.type === 'ssVipSuccess') {
				await getApp().getMemberTt(this)
				this.showLock = false
				await this.getList()
				this.getVideoDetail()
			}
			//#ifdef MP-TOUTIAO
			// 第一个参数是导流场景：1支付前，2支付后，3首页，4播放页按钮，第二个参数是导流目标，1是加关，2是加群
			if(getApp().globalData.isOperateType){
				this.getDyDiversion(2, 1)
			}
			
			this.getGroupInfo(2, 2)
			//#endif
		},
		buyClick(e) {
			console.log('buyClick', e);
			this.nowGoodsLock = this.videoList[this.currentIndex]['goodsLocks'][e];
			if (this.nowGoodsLock.releaseWay != 'FRUIT_PAY') {
				// uni.showToast({
				// 	title: `暂不支持该锁《${this.nowGoodsLock.releaseWay}》`,
				// 	icon: 'none'
				// });
				return;
			}

			let nowNum = this.nowGoodsLock.fruitNum || 0;
			console.log('this.nowGoodsLock', this.nowGoodsLock);
			if (this.nowGoodsLock['directBuying']) {
				this.isPay();
				return;
			}

			if (this.balance >= nowNum) {
				this.isBuy();
			} else {
				if (this.nowGoodsLock['goodsType'] == 'COMPILATIONS') {
					// 直接唤起支付
					this.isPay();
				} else {
					this.showMoney = true;
					this.safeguard = false
				}
			}
		},
		buyClick1(e) {
			console.log('buyClick', e);
			this.nowGoodsLock = this.videoList[this.currentIndex]['goodsLocks'][e];
			if (this.nowGoodsLock.releaseWay != 'FRUIT_PAY') {
				// uni.showToast({
				// 	title: `暂不支持该锁《${this.nowGoodsLock.releaseWay}》`,
				// 	icon: 'none'
				// });
				return;
			}

			let nowNum = this.nowGoodsLock.fruitNum || 0;
			console.log('this.nowGoodsLock', this.nowGoodsLock);
			if (this.nowGoodsLock['directBuying']) {
				this.isPay();
				return;
			}

			if (this.balance >= nowNum) {
				this.isBuy();
			} else {
				if (this.nowGoodsLock['goodsType'] == 'COMPILATIONS') {
					// 直接唤起支付
					this.isPay();
				} else {
					// this.showMoney = true;
					this.safeguard = false
				}
			}
		},
		isPay: util.throttle(function () {
			// 回传上报
			//#ifdef MP-KUAISHOU
			this.postActive('order')
			//#endif
			uni.showLoading({
				title: '加载中'
			});
			let postData = '',
				url = '';
			if (this.nowGoodsLock['directBuying']) {
				postData = {
					commodityBuyType: 'PAY',
					commodityVOS: [{
						commodityId: this.nowGoodsLock.commodityId,
						total: 1
					}]
				};
				url = '/wealth/api/pay_client/top_up_preorder_shopping';
			} else {
				postData = {
					moneyFen: this.nowGoodsLock.fruitNum,
					payUse: 'FOR_BALANCE',
					useId: 3
				};
				url = '/wealth/api/pay_client/top_up_preorder';
			}
			let header =  {
				'content-type': 'application/json;charset=UTF-8',
				'episodic-drama-id': String(this.videoList[this.currentIndex].id) || '0',
				'compilations-id': String(this.videoList[this.currentIndex].compilationsId) || '0'
			}
			if (this.versionView) {
				header['ios-pay-version'] = true
			} else {
				header['ios-pay-version'] = false
			}
			this.zwyRequest({
				header,
				method: 'post',
				url: url,
				data: postData
			}).then(res => {
				uni.hideLoading();
				console.log('moneyClick', res);
				//#ifdef MP-KUAISHOU
				this.ksPay(res);
				//#endif
				//#ifdef MP-TOUTIAO
				this.ttPay(res);
				//#endif
			});
		}, 2000),
		async onHide() {
			this.interValTime && clearInterval(this.interValTime)
			//#ifdef MP-TOUTIAO
			// 拷贝群口令
			if (this.canCopyGroupLink && this.copyGroupLinkBefore) {
				// this.copyWatchword(this.copyGroupLinkBefore)
				// 上报后台
				if (this.copyGroupLinkBefore) {
					this.callBackWardCopy(this.copyGroupLinkBeforeId)
				}
				this.copyGroupLinkBefore = ''
				this.canCopyGroupLink = false
			}
			//#endif
			//#ifdef MP-KUAISHOU
			if (!getApp().globalData.notSetWatchWord) {
				//#ifdef MP-KUAISHOU
				this.setWatchWord();
				//#endif
			} else {
				getApp().globalData.notSetWatchWord = false;
			}
			//#endif
		},
		async onUnload() {
			//#ifdef MP-TOUTIAO
			// 拷贝群口令
			if (this.canCopyGroupLink && this.copyGroupLinkBefore) {
				// this.copyWatchword(this.copyGroupLinkBefore)
				// 上报后台
				if (this.copyGroupLinkBefore) {
					this.callBackWardCopy(this.copyGroupLinkBeforeId)
				}
				this.copyGroupLinkBefore = ''
				this.canCopyGroupLink = false
			}
			//#endif

			//#ifdef MP-KUAISHOU
			if (!getApp().globalData.notSetWatchWord) {
				this.setWatchWord();
			} else {
				getApp().globalData.notSetWatchWord = false;
			}
			if (this.kstimer) {
				this.kstimer = null
				clearInterval(this.kstimer)
			}
			//#endif
		},
		async ttPay(res) {
			if (res) {
				if(res.touTiaoGeneralPayApi) { // 通用支付
					this.orderInfo = res
					await this.payMessSsVipNew(res, 'allVideo')

					if(!this.versionView) {
						if (this.nowGoodsLock['directBuying']) {
							this.isBuyRight();
						} else {
							uni.showToast({
								title: '充值成功',
								icon: 'none'
							});
							tt.showFavoriteGuide({
								type: "bar",
								content: "一键添加到「我的小程序」",
								position: "bottom",
								success(res) {
									console.log("引导组件展示成功", res);
								},
								fail(err) {
									console.log("引导组件展示失败", err);
								},
							});
							this.noUseVideo = false;
							this.isBuy();
						}
					}
					
				} else {
					this.orderInfo = res;
					let orderInfo = {
						order_id: res.touTiaoApi.orderId,
						order_token: res.touTiaoApi.orderToken
					};
					uni.pay({
						service: 5,
						orderInfo: orderInfo,
						success: res => {
							console.log('success', res);
							if (this.nowGoodsLock['directBuying']) {
								this.isBuyRight();
							} else {
								uni.showToast({
									title: '充值成功',
									icon: 'none'
								});
								tt.showFavoriteGuide({
									type: "bar",
									content: "一键添加到「我的小程序」",
									position: "bottom",
									success(res) {
										console.log("引导组件展示成功", res);
									},
									fail(err) {
										console.log("引导组件展示失败", err);
									},
								});
								this.noUseVideo = false;
								this.isBuy();
							}
						},
						fail: res => {
							console.log('fail', res);
							this.noUseVideo = false;
						}
					});
				}
			}
		},
		ksPay(res) {
			if (res) {
				this.orderInfo = res;
				let orderInfo = {
					order_no: res.kuaiShouApi.orderNo,
					order_info_token: res.kuaiShouApi.orderInfoToken
				};
				ks.pay({
					serviceId: '1',
					orderInfo: orderInfo,
					success: res => {
						getApp().globalData.notSetWatchWord = true;
						console.log('success', res);
						if (this.nowGoodsLock['directBuying']) {
							this.isBuyRight();
						} else {
							uni.showToast({
								title: '充值成功',
								icon: 'none'
							});
							this.noUseVideo = false;
							this.isBuy();
						}
					},
					fail: res => {
						console.log('fail', res);
						this.noUseVideo = false;
					}
				});
			}
		},
		getBalance() {
			return this.zwyRequest({
				header: {
					'content-type': 'application/json;charset=UTF-8'
				},
				method: 'GET',
				url: '/wealth/api/balance/user_balance'
			}).then(res => {
				console.log('getBalance', res);
				this.balance = res || 0;
				// this.balance = 100;
			});
		},
		moneyClose(val) {
			this.noUseVideo = false;
			this.showMoney = false;
			this.safeguard = true
			if (val && val.type === 'closePoup') {
				this.topBack()
			}
		},
		lockClose() {
			this.showLock = false;
		},
		dramaListClose() {
			this.showDramaList = false;
		},
		chooseSeq() {
			this.showDramaList = true;
		},
		isPlay() {
			this.isShowBtnPlay = false;
			this.isPlayNowNewPlayer = true
			this.pushHistory();
		},
		isEnded(e) {
			console.log('isEnded');
			if (this.currentIndex < this.videoList.length - 1 && this.videoInfoList[this.currentIndex]) {
				this.$statis({
					action: 'PLAYCOMPLETED',
					compilationId: String(this.videoInfoList[this.currentIndex].episodicDrama.compilationsId),
					episodicDramaId: String(this.videoInfoList[this.currentIndex].episodicDrama.id),
					videoId: String(this.videoInfoList[this.currentIndex].episodicDrama.videoId),
					authorId: this.compInfo.laikanAccountId ? String(this.compInfo.laikanAccountId) : '0',
				});

				this.currentIndex++;
				this.changeTab(this.currentIndex);
			} else {
				uni.showToast({
					title: '已看完最新一集',
					icon: 'none'
				});
				this.isFinish();
			}
		},
		async pushHistory() {
			if (this.hasPushList[this.currentIndex]) return;
			if (this.videoInfoList[this.currentIndex]) {
				this.$statis({
					action: 'PLAY',
					compilationId: String(this.videoInfoList[this.currentIndex].episodicDrama
						.compilationsId),
					episodicDramaId: String(this.videoInfoList[this.currentIndex].episodicDrama.id),
					videoId: String(this.videoInfoList[this.currentIndex].episodicDrama.videoId),
					authorId: this.compInfo.laikanAccountId ? String(this.compInfo.laikanAccountId) : '0',
				});
			}
			this.hasPushList[this.currentIndex] = true;
			this.zwyRequest({
				url: '/cdp/user_history/video',
				data: {
					videoId: String(this.videoInfoList[this.currentIndex].videoId),
					episodicDramaId: String(this.videoList[this.currentIndex].id) || '',
				},
				method: 'POST',
				header: {
					'content-type': 'application/x-www-form-urlencoded'
				}
			});
		},
		isLast() {
			let last = this.currentIndex - 1;
			if (last < 0) {
				uni.showToast({
					title: '已是第一集',
					icon: 'none'
				});
				return;
			}
			this.changeTab(this.currentIndex - 1);
		},
		isNext() {
			let next = this.currentIndex + 1;
			if (next >= this.videoList.length) {
				uni.showToast({
					title: '已看完最新一集',
					icon: 'none'
				});
				return;
			}
			this.changeTab(next);
		},
		autoBuy() {
			// 从渠道进来 前一个视频 是否解锁，解锁才能继续解锁
			let objBefore = this.videoList[this.currentIndex - 1]
			if (getApp().globalData.batchId && getApp().globalData.seqEpisodeListSwitch) {
				if (objBefore && objBefore.needUnLock) {
					this.viewAlertBox()
				} else {
					let nowLock = this.videoList[this.currentIndex]['goodsLocks'];
					this.nowGoodsLock = nowLock.find((item, index) => {
						if (item.releaseWay == 'FRUIT_PAY' && item.goodsType == 'EPISODIC_DRAMA') return true;
					});
					if (this.nowGoodsLock && this.nowGoodsLock.fruitNum && this.balance >= this.nowGoodsLock.fruitNum) {
						this.isBuy();
						return;
					}
					this.showLock = true;
					this.showDramaList = false;
					this.dyInterestShow = false

				}
			} else {
				let nowLock = this.videoList[this.currentIndex]['goodsLocks'];
				this.nowGoodsLock = nowLock.find((item, index) => {
					if (item.releaseWay == 'FRUIT_PAY' && item.goodsType == 'EPISODIC_DRAMA') return true;
				});
				if (this.nowGoodsLock && this.nowGoodsLock.fruitNum && this.balance >= this.nowGoodsLock.fruitNum) {
					this.isBuy();
					return;
				}
				this.showLock = true;
				this.showDramaList = false;
				this.dyInterestShow = false

			}
		},
		buyoneAd() {
			let nowIndex = this.currentIndex;
			let tempList = JSON.parse(JSON.stringify(this.videoList));
			tempList[nowIndex]['needUnLock'] = false;
			this.videoList = tempList;

			let queryUrl = this.fakeId ? `/cdp/episodic_drama/v2/dramas/${this.fakeId}?enableDouYinAd=true` : `/cdp/episodic_drama/dramas/${this.compilationId}?enableDouYinAd=true`
			// IAA临时ID
			if(this.iaaUnLockStr) {
				queryUrl += `&ticket=${this.iaaUnLockStr}`
			}
			this.zwyRequest({
				url: queryUrl
			}).then(async res => {
				if (!this.checkNeedLogin()) {
					res = res.filter(item => item.goodsLocks.length == 0); //过滤锁
				}

				this.videoList = res;
				uni.showToast({
					title: '广告解锁成功',
					icon: 'none'
				});
				this.isOnlyAd = false;
				this.hasBuyNum++;

				// #ifdef MP-TOUTIAO
				if (getApp().globalData.dyInsertMess.viewDyPopup) {
					this.viewDyInsert()
				}
				if(getApp().globalData.dyGroupMess.viewJqPopup){
					this.addGroupInsert()
				}else{
					this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.close()
					this.pauseNum = 0
				}
				// #endif
				if (this.hasBuyNum >= this.buySpace && this.userLockId) {
					//购买过两集且需要关注服务号
					// #ifdef MP-KUAISHOU
					this.resetAllLock();
					// #endif
					// #ifdef MP-TOUTIAO
					let nowApp = await this.getLittleAppNow()
					let statusFollow = await this.getFollowCheckStatus()
					if (getApp().globalData.nowTTClient && nowApp === 'Douyin') {
						if (!statusFollow.hasFollowed) {
							this.resetAllLock();
						}
					} else {
						this.resetAllLock();
					}
					// #endif
				}
				this.getksFoucsPopup(nowIndex)
			});
		},

		async buyone(title) {
			let nowIndex = this.currentIndex;
			let tempList = JSON.parse(JSON.stringify(this.videoList));
			if (this.nowGoodsLock['goodsType'] == 'COMPILATIONS') {
				tempList = tempList.map(item => {
					item['needUnLock'] = false;
					return item;
				});
			} else if (this.nowGoodsLock['goodsType'] == 'EPISODIC_DRAMA') {
				tempList[nowIndex]['needUnLock'] = false;
			}
			this.videoList = tempList;

			this.hasBuyNum++;
			console.log('this.hasBuyNum----------9999999999999999999', this.hasBuyNum);

			if (this.hasBuyNum >= this.buySpace && this.userLockId) {
				//购买过两集且需要关注服务号
				// #ifdef MP-KUAISHOU
				this.resetAllLock();
				// #endif
				// #ifdef MP-TOUTIAO
				let nowApp = await this.getLittleAppNow()
				let statusFollow = await this.getFollowCheckStatus()
				if (getApp().globalData.nowTTClient && nowApp === 'Douyin') {
					if (!statusFollow.hasFollowed) {
						this.resetAllLock();
					}
				} else {
					this.resetAllLock();
				}

				// #endif
			}
			uni.showToast({
				title: title ? title : '购买成功',
				icon: 'none'
			});
			// #ifdef MP-TOUTIAO
			if (getApp().globalData.dyInsertMess.viewDyPopup) {
				this.viewDyInsert()
			}
			if(getApp().globalData.dyGroupMess.viewJqPopup){
				this.addGroupInsert()
				}else{
					this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.close()
					this.pauseNum = 0
				}
			// #endif
			// #ifdef MP-KUAISHOU
			this.showLock = false
			this.showAd = false
			this.storageCurrentTime()
			// #endif
		},
		resetAllLock() {
			this.userLock = true;
			let res = JSON.parse(JSON.stringify(this.videoList));
			res = res.map((item, index) => {
				if (item['needUnLock']) {
					item['goodsLocks'] = this.userLockArr;
					item['lock'] = true;
					item['needUnLock'] = true;
				}
				return item;
			});
			this.videoList = JSON.parse(JSON.stringify(res));
		},
		checkCanAutoBuy() {
			let lockCompilations = false;
			let lockEpisodic = false;
			let lockAd = false;
			let nowLockList = this.videoList[this.currentIndex]['goodsLocks'];
			nowLockList && nowLockList.forEach((item, index) => {
				if (item.goodsType == 'EPISODIC_DRAMA' && item['releaseWay'] == 'FRUIT_PAY') lockEpisodic =
					true;
				else if (item.goodsType == 'COMPILATIONS' && item['releaseWay'] == 'FRUIT_PAY')
					lockCompilations = true;
				else if (item.goodsType == 'EPISODIC_DRAMA' && item['releaseWay'] == 'WATCH_THE_ADS') lockAd =
					true;
			});
			if (lockAd && !lockEpisodic && !lockCompilations) return false;
			return !(lockEpisodic && lockCompilations);
		},
		isBuyRight() {
			console.log('this.orderInfo', this.orderInfo);
			if (this.orderInfo && this.orderInfo.shoppingPackageId) {
				this.zwyRequest({
					url: '/cdp/payment/direct_buying/info',
					data: {
						shoppingPackageId: this.orderInfo.shoppingPackageId
					},
					method: 'get'
				}).then(res => {
					console.log('购买逻辑res.isPaid', res);
					if (res && res.isPaid) {
						this.noUseVideo = false;
						this.hasBuyObj[this.compInfo.id] = true;
						uni.setStorageSync('hasBuy', this.hasBuyObj);
						this.closeAllPopup();
						this.getBalance();
						this.buyone();
						setTimeout(() => {
							this.getVideoDetail();
						}, 100);
					}
				});
			}
		},
		isBuy() {
			let tempUrl =
				this.nowGoodsLock['goodsType'] == 'COMPILATIONS' ?
					`/cdp/payment/compilations/${this.compInfo.id}` :
					`/cdp/payment/episodic_drama/${this.videoList[this.currentIndex].id}`;
			this.zwyRequest({
				url: tempUrl,
				data: {
					lockId: this.nowGoodsLock.id
				},
				header: {
					'content-type': 'application/x-www-form-urlencoded;charset=UTF-8'
				},
				method: 'post'
			}).then(res => {
				console.log('购买逻辑isBuy', res);
				if (res) {
					this.hasBuyObj[this.compInfo.id] = true;
					uni.setStorageSync('hasBuy', this.hasBuyObj);
					this.closeAllPopup();
					this.getBalance();
					this.buyone();
					setTimeout(() => {
						this.getVideoDetail();
					}, 100);
				}
			});
		},
		closeAllPopup() {
			this.noUseVideo = false;
			this.showMoney = false;
			// #ifdef MP-TOUTIAO
			this.safeguard = true
			// #endif
			this.showLock = false;
			this.showDramaList = false;
			this.viewBox = false
			this.foucsKsPopup = false
		},
		async changeTab(e) {
			clearInterval(this.intervalId);
			// 水印相关逻辑
			let nowDataObj = this.videoList[e]
			let userInfo = uni.getStorageSync('userInfo') || {};
			if (nowDataObj && nowDataObj.icpNumber) {
				this.icpNumber = nowDataObj.icpNumber
				this.viewIcpNumber = true
				this.userInfo = userInfo
				this.timerWater && clearTimeout(this.timerWater)
				this.timerWater = setTimeout(() => {
					this.viewIcpNumber = false
				}, 5000)
			} else {
				this.icpNumber = ''
				this.viewIcpNumber = false
				this.userInfo = userInfo
			}

			this.closeAllPopup();
			this.checkHasAd(this.videoList[e]);
			this.currentIndex = Number(e);

			if (this.videoList[e] && this.videoList[e]['needUnLock']) {
				if (this.hasBuyObj[this.compInfo.id] && this.checkCanAutoBuy()) {
					// 购买过 自动购买
					this.autoBuy();
					// #ifdef MP-TOUTIAO
					// 第一个参数是导流场景：1支付前，2支付后，3首页，4播放页按钮，第二个参数是导流目标，1是加关，2是加群
					if(getApp().globalData.isOperateType){
						this.getDyDiversion(2, 1)
					}
					this.getGroupInfo(2, 2)
					// #endif

					return;
				} else {
					// 未购买过 || 合集锁和剧集锁同时存在
					// 从渠道进来 前一个视频 是否解锁，解锁才能继续解锁
					let objBefore = this.videoList[this.currentIndex - 1]
					if (getApp().globalData.batchId && getApp().globalData.seqEpisodeListSwitch) {
						if (objBefore && objBefore.needUnLock) {
							this.viewAlertBox()
						} else {
							this.showLock = true;
							this.showDramaList = false;
							this.dyInterestShow = false
						}
					} else {
						this.showLock = true;
						this.showDramaList = false;
						this.dyInterestShow = false
					}
					return;
				}
			} else {
				// #ifdef MP-TOUTIAO
				await this.getGroupInfo(1, 2)
				if (getApp().globalData.dyInsertMess.viewDyPopup) {
					this.viewDyInsert()
				}
				if(getApp().globalData.dyGroupMess.viewJqPopup){
					console.log('9999999999999999999999999999999999999999999');
					this.addGroupInsert()
				} else{
					this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.close()
					this.pauseNum = 0
				}
				//
				// #endif
			}
			this.storageCurrentTime(e)
			this.getVideoDetail();
			this.getVideoDetail(this.currentIndex + 1);
		},
		getBeforeksFoucsPopup() {
			let { currentLock, addedFansRelativePosition } = this.ksSpreaModeObj
			let num = 0
			if (this.ksSpreaModeObj.spreadMode == 'KUAISHOU_ADDED_FANS_PAY_BEFORE_DIALOG_CLOSED' || this.ksSpreaModeObj.spreadMode == 'KUAISHOU_ADDED_FANS_PAY_BEFORE_DIALOG_NOT_CLOSED') {
				num = currentLock - addedFansRelativePosition
			} else {
				num = currentLock + addedFansRelativePosition
			}
			this.ksSpreaModeObj.ksPointStartNum = num > 0 ? num : 0
			console.log(num, this.ksSpreaModeObj, 'this.ksSprea')
		},
		async getksFoucsPopup(val = this.currentIndex) {
			if (this.ksSpreaModeObj.spreadMode) {
				for (let i = 0; i < this.videoList.length; i++) {
					if ((this.ksSpreaModeObj.ksPointStartNum + this.ksSpreaModeObj.dialogRate * i) == (val) && !this.videoList[val].needUnLock) {
						console.log(val, 'index,暂停')
						this.foucsKsPopup = true
						this.$statis({
							action: 'SHOW_NOTICE_FRAME'
						})
					}

				}
			}
		},
		storageCurrentTime(e) {
			this.zwyRequest({
				method: 'get',
				url: `/cdp/user_subscribe/official_account?officialAccountAppId=${getApp().globalData.followedId}`
			}).then(res => {
				this.foucsKsPopup = false
				if (!res.subscribe) {

					if (this.ksSpreaModeObj.spreadMode) {
						this.getBeforeksFoucsPopup()
						this.getksFoucsPopup()
						return
					} else if (!this.followTimer.startTime) {
						this.followTimer.startTime = Date.parse(new Date())
						this.followTimer.timer1 = this.followTimer.startTime + 1000 * 5 * 60
						this.followTimer.timer2 = this.followTimer.startTime + 1000 * 12 * 60
						this.followTimer.timer3 = this.followTimer.startTime + 1000 * 20 * 60
						this.getksFollowTime()
					}
				}
			})
		},
		//获取快手曝光时间
		getksFollowTime() {
			console.log('开始倒计时------')
			this.kstimer = setInterval(() => {
				let newDate = Date.parse(new Date())
				if (newDate == this.followTimer.timer1 || newDate == this.followTimer.timer2 || newDate == this.followTimer.timer3) {
					this.showFollow = true
					this.showFollowClass = true
					this.$statis({
						action: 'SHOW_NOTICE_FRAME'
					})
					setTimeout(() => {
						this.showFollowClass = false
					}, 18200);
					setTimeout(() => {
						this.showFollow = false
					}, 20000);
				}
			}, 1000);


		},
		//用户点击关注
		tapFollow(e) {
			console.log('关注成功')
			this.showFollow = false
			this.showFollowClass = false
			this.foucsKsPopup = false
			this.ksSpreaModeObj.spreadMode = ''
			clearInterval(this.kstimer)
			uni.$emit('tapFollow')
		},
		async getVideoDetail(nowIndex = this.currentIndex) {
			if (nowIndex > this.videoList.length - 1) return;
			if (!this.videoUrlList[nowIndex]) {
				let currentitem = this.videoList[nowIndex];
				console.log('nowIndex', nowIndex);
				console.log('currentitem', currentitem);
				let id = currentitem.videoId;
				let fakeId = currentitem.videoFakeId;
				let postUrl = fakeId ? `/cdp/video/v3/${fakeId}` : `/cdp/video/v2/${id}`;
				let obj = {}
				if (currentitem && currentitem.id) {
					obj.episodicDramaId = currentitem.id
				}

				// IAA临时ID
				if(this.iaaUnLockStr) {
					obj.ticket = this.iaaUnLockStr
				}
				this.zwyRequest({
					url: postUrl,
					data: obj
				}).then(res => {
					console.log('getVideoInfo----剧集详情', res);
					res['objectFit'] = 'contain';
					if (res && res.videoFiles && res.videoFiles[0] && res.videoFiles[0].videoUrl) {
						this.videoUrlList[nowIndex] = res.videoFiles[0].videoUrl;
						res['duration'] = res.videoFiles[0]['duration'];
						let screenWidth = this.screenWidth;
						var vHeight = res.videoFiles && res.videoFiles[0] ? (screenWidth / res.videoFiles[0]
							.width) * res.videoFiles[0].height : 0;

						if (this.playerH != '100%' && vHeight > parseInt(this.playerH)) {
							res['objectFit'] = 'cover';
						}
						let videoWidth = res.videoFiles && res.videoFiles[0] ? res.videoFiles[0].width : 0;
						let videoHeight = res.videoFiles && res.videoFiles[0] ? res.videoFiles[0].height : 0;
						res['actualHeight'] = Math.ceil((screenWidth * videoHeight) / videoWidth);
						console.log('getVideoDetail', res);

						// 新播放器逻辑
						console.log('currentitem----', currentitem)
						if(this.videoList[this.currentIndex].videoId === res.videoId) {
							setTimeout(() => {
								this.nowNewPlayVideo(res.videoId)
							}, 500)
						}

					} else {
						if (nowIndex == this.currentIndex && res && res.episodicDrama && res.episodicDrama
							.needUnLock && !this.showLock) {
							// 解锁失败则再次展示锁
							this.showLock = true;
							this.dyInterestShow = false
						}
						console.log('获取不到视频地址', nowIndex);
					}
					// H5卡点校验
					if (getApp().globalData.popupMess.viewPopup) {
						this.viewPopupQiWei()
					}

					this.videoInfoList[nowIndex] = res;
					this.$forceUpdate();
					// let currentIndex = this.currentIndex + 1
					// if (this.insertStartIndex && !res.isIaa) {
					// 	if (((currentIndex - this.insertStartIndex) % this.insertSpace == 0 && currentIndex > this.insertStartIndex) || currentIndex == this.insertStartIndex) {
					// 		this.insertAdTt = true
					// 		console.log('展示插屏广告尝试中')
					// 		this.$refs.insertAdTt && this.$refs.insertAdTt.isShowAd()
					// 	}
					// }
					this.videoInfoList[nowIndex] = res;
					this.$forceUpdate();
				});
			} else{
				// 新播放器逻辑
				if(nowIndex === this.currentIndex) {
					setTimeout(() => {
						this.showLoadingNewPlayer = true
						this.nowNewPlayVideo(this.videoList[this.currentIndex].videoId)
					}, 500)
				}
			}
			if (this.userLockBtnHasClickSeq != -1 && this.userLockBtnHasClickSeq != this.currentIndex) {
				this.$uma && this.$uma.trackEvent('Ume_ServiceNumber', {
					name: 'Ume_SN_returnkey_app'
				});
				this.userLockBtnHasClickSeq = -1;
				// 用户点击跳转服务号后直接返回
				uni.setStorageSync('userLockBtnClick', false)
			}
		},
		checkHasAd(res) {
			console.log('checkHasAd', res);
			if (res && !res.needUnLock) {
				// this.showAd = false;
				this.isIaaAd = false
				return false
			};
			let tempCheck = false;
			let nowGoodsLocks = res.goodsLocks;
			this.isIaaAd = res && res.isIaa
			if (nowGoodsLocks.findIndex(item => item.releaseWay == 'WATCH_THE_ADS') != -1) tempCheck = true;
			this.showAd = tempCheck;
			this.nowGoodsLock = nowGoodsLocks.find(item => item.releaseWay == 'WATCH_THE_ADS')
		},
		getDetail() {
			return this.zwyRequest({
				url: this.fakeId ? '/cdp/compilations/v2/' + this.fakeId : '/cdp/compilations/' + this
					.compilationId,
				noErr: true
			}).then(res => {
				console.log('getDetail', res);
				if (Array.isArray(res.efficientLocks) && res.efficientLocks.length === 1 && typeof res.efficientLocks[0] === 'object') {
					if (res.efficientLocks[0].releaseWay == "WATCH_THE_ADS") {
						this.isFree = "WATCH_THE_ADS"
					}
				}
				if (res.adsSetting) {
					this.insertStartIndex = res.adsSetting.beginWithEpisodicSequence || ''; //起始集数
					this.insertSpace = res.adsSetting.intervalNum || ''; //插屏广告频率
				}
				if (!res.id) {
					this.noDataAndBackVideo();
					return;
				}
				this.compInfo = res;
			});
		},
		async getList() {
			await this.getBalance();
			let queryUrl = this.fakeId ? `/cdp/episodic_drama/v2/dramas/${this.fakeId}?enableDouYinAd=true` : `/cdp/episodic_drama/dramas/${this.compilationId}?enableDouYinAd=true`
			// IAA临时ID
			if(this.iaaUnLockStr) {
				queryUrl += `&ticket=${this.iaaUnLockStr}`
			}
			return this.zwyRequest({
				url: queryUrl,
				noErr: true
			}).then(async res => {
				console.log('getList', res);
				if (!this.checkNeedLogin()) {
					res = (res || []).filter(item => item.goodsLocks.length == 0); //过滤锁
				}
				let freeItem = (res || []).filter(item => item.goodsLocks.length == 0)
				this.totalFreeTime = freeItem.reduce((pre, cur) => { return pre + Number(cur.duration) }, 0)
				console.log(this.totalFreeTime, 'freeItem------------');
				console.log(`
					userLockId:${this.userLockId},
					userLockSequence:${this.userLockSequence}
				`)

				let findItem = (res || []).find((tempItem, tempIndex) => {
					return tempItem['goodsLocks'].length > 0;
				});

				if (this.userLockId && this.userLockSequence != -1) {
					// 需要关注服务号时

					console.log(`
						this.balance:${this.balance},
						this.buySpace:${this.buySpace},
						findItem:${findItem}
					`)

					if ((this.balance > 0 || this.buySpace == 0) && findItem) {
						//充过钱 则所有锁变成关注服务号锁
						console.log('balance', 1296);
						// #ifdef MP-KUAISHOU
						this.userLock = true;
						// #endif
						// #ifdef MP-TOUTIAO
						let nowApp = await this.getLittleAppNow()
						let statusFollow = await this.getFollowCheckStatus()
						if (getApp().globalData.nowTTClient && nowApp === 'Douyin') {
							if (!statusFollow.hasFollowed) {
								this.userLock = true
							} else {
								this.userLock = false
							}
						} else {
							this.userLock = true
						}

						// #endif
						if (this.buySpace == 0) {
							res = res.map((item, index) => {
								// #ifdef MP-KUAISHOU
								if (this.userLockSequence - 1 <= index) {
									item['goodsLocks'] = this.userLockArr;
									item['lock'] = true;
									item['needUnLock'] = true;
								}
								// #endif
								// #ifdef MP-TOUTIAO
								console.log('调试锁状态处理2112', this.userLock)
								if (this.userLockSequence - 1 <= index && this.userLock) {
									item['goodsLocks'] = this.userLockArr;
									item['lock'] = true;
									item['needUnLock'] = true;
								}
								// #endif
								return item;
							});
						} else {
							res = res.map((item, index) => {
								// #ifdef MP-KUAISHOU
								if (item['needUnLock']) {
									item['goodsLocks'] = this.userLockArr;
									item['lock'] = true;
									item['needUnLock'] = true;
								}
								// #endif
								// #ifdef MP-TOUTIAO
								if (item['needUnLock'] && this.userLock) {
									item['goodsLocks'] = this.userLockArr;
									item['lock'] = true;
									item['needUnLock'] = true;
								}
								// #endif
								return item;
							});
						}
					} else {
						if (!findItem) {
							// 不存在锁则填充关注服务号锁
							// 否则看完X集以后 所有锁变为关注服务号锁，直到关注了服务号
							// #ifdef MP-KUAISHOU
							this.userLock = true;
							// #endif
							// #ifdef MP-TOUTIAO
							let nowApp = await this.getLittleAppNow()
							let statusFollow = await this.getFollowCheckStatus()
							if (getApp().globalData.nowTTClient && nowApp === 'Douyin') {
								if (!statusFollow.hasFollowed) {
									this.userLock = true
								} else {
									this.userLock = false
								}
							} else {
								this.userLock = true
							}
							// #endif
							res = res.map((item, index) => {
								// #ifdef MP-KUAISHOU
								if (this.userLockSequence - 1 <= index) {
									item['goodsLocks'] = this.userLockArr;
									item['lock'] = true;
									item['needUnLock'] = true;
								}
								// #endif
								// #ifdef MP-TOUTIAO
								console.log('调试锁状态处理', this.userLock)
								if (this.userLockSequence - 1 <= index && this.userLock) {
									item['goodsLocks'] = this.userLockArr;
									item['lock'] = true;
									item['needUnLock'] = true;
								}
								// #endif
								return item;
							});
						} else {
							// #ifdef MP-TOUTIAO
							this.ttUserLock = true
							// #endif
							console.log('存在锁');
							// 存在锁 则走 先购买N集后关注锁的逻辑
						}
					}
				}

				this.videoList = res;

				// 存储下合集ID， header用
				if(res && res[0]) {
					uni.setStorageSync('newVideoCompilationId', res[0].compilationsId)
				}
				this.videoInfoList = new Array(this.videoList.length).fill(null);
				this.videoUrlList = new Array(this.videoList.length).fill(null);
				this.hasPushList = new Array(this.videoList.length).fill(false);
				// 检查当前剧是否是IAA
				this.isIaaAd = res && res.some(item => item.isIaa)
				this.checkAddIaaMess()
			});
		},
		// 获取抖音关注
		getFollowCheckStatus() {
			console.log(this.awemeId,'app===========', tt.checkFollowAwemeState)
			return new Promise((resolve, reject) => {
				tt.checkFollowAwemeState({
					awemeId: this.awemeId,
					success: (res) => {
						console.log('app===========', res)
						if (res && res.hasFollowed) {
							resolve({
								hasFollowed: true
							})
						} else {
							resolve({
								hasFollowed: false
							})
						}
					},
					fail: (error) => {
						console.log('app===========1212', error)
						resolve({
							hasFollowed: false
						})
					}
				})
			})
		},
		// 获取宿主小程序
		getLittleAppNow() {
			console.log('res===========', 'dasdasd')
			return new Promise((resolve, reject) => {
				tt.getSystemInfo({
					success: (res) => {
						console.log('res===========', res)
						if (res && res.appName) {
							resolve(res.appName)
						} else {
							resolve('')
						}
					},
					fail: () => {
						resolve('')
					}
				})
			})
		},
		// 获取充值记录列表
		async getRecordList() {
			try {
				let res = await this.zwyRequest({
					url: `/wealth/api/pay_order/pay_record?nextId=${0}`
				})
				// return res
			} catch (error) {
				console.log(error)
			}
		},
		// 加关导流
		closeDyInterest() {
			this.dyInterestShow = false
		},
		async getDyDiversion(num, diversionTarget) {
			let res = await this.zwyRequest({
				method: 'get',
				url: `/douYin/diversion?diversionScene=${num}&diversionTarget=${diversionTarget}`
			})

			if (res && res[0]) {
				getApp().globalData.dyInsertMess = res[0]
				getApp().globalData.dyInsertMess.viewDyPopup = true

			}
			// getApp().globalData.dyInsertMess.openId = '_0006m_kCyUhotqRGKcbQI9HIqfbTJhtD_Rn'
		},
		// 一键加关卡点逻辑
		async viewDyInsert() {
			let {
				diversionSceneType,//导流场景 支付前，支付后
				guideSequence, // 卡点集数
				dialogRate, // 弹窗频率
				guideDialogSwitch, // 弹窗是否可关闭
				douYinUserId,//抖音号
			} = getApp().globalData.dyInsertMess
			console.log(getApp().globalData.dyInsertMess, 'getApp().globalData.dyInsertMess------');
			this.awemeId = douYinUserId
			let currentIndex = this.currentIndex + 1
			let nowBuySpace = this.hasBuyNum
			this.guideDialogSwitch = guideDialogSwitch

			if (!diversionSceneType || diversionSceneType == 1) { // 付费前
				if (guideDialogSwitch) { // 有弹窗频率，可关闭
					if (currentIndex === guideSequence) {
						this.intervalId = setInterval(this.getFollowStatus, 1000);
						let statusFollow = await this.getFollowCheckStatus()
						this.statusFollow =statusFollow.hasFollowed
						console.log(statusFollow, '关注状态---关注状态---关注状态---1');
						if (!statusFollow.hasFollowed) {
							this.dyInterestShow = true
							this.$statis({
								action: 'EXPOSURE',
								position: 'DY_DIVERSION_DY_USER/DY_DIVERSION_BEFORE_PAY',
							})
							if(!getApp().globalData.isOperateType){
								this.getMiddlePopup()
							}
						}
					} else if (dialogRate && currentIndex > guideSequence && (currentIndex - guideSequence) % dialogRate === 0) {
						this.intervalId = setInterval(this.getFollowStatus, 1000);
						let statusFollow = await this.getFollowCheckStatus()
						this.statusFollow =statusFollow.hasFollowed
						console.log(statusFollow, '关注状态---关注状态---关注状态---2');
						if (!statusFollow.hasFollowed) {
							this.dyInterestShow = true
							this.$statis({
								action: 'EXPOSURE',
								position: 'DY_DIVERSION_DY_USER/DY_DIVERSION_BEFORE_PAY',
							})
							if(!getApp().globalData.isOperateType){
								this.getMiddlePopup()
							}
						}
					} else {
						this.pauseNum = 0
						this.dyInterestShow = false
						clearInterval(this.intervalId);
					}
				} else { // 不可关闭
					if (currentIndex === guideSequence || currentIndex > guideSequence) {
						this.intervalId = setInterval(this.getFollowStatus, 1000);
						let statusFollow = await this.getFollowCheckStatus()
						this.statusFollow =statusFollow.hasFollowed
						console.log(statusFollow, '关注状态---关注状态---关注状态---3');
						if (!statusFollow.hasFollowed) {
							this.dyInterestShow = true
							this.$statis({
								action: 'EXPOSURE',
								position: 'DY_DIVERSION_DY_USER/DY_DIVERSION_BEFORE_PAY',
							})
							if(!getApp().globalData.isOperateType){
								this.getMiddlePopup()
							}
						}
					} else {
						this.pauseNum = 0
						this.dyInterestShow = false
						clearInterval(this.intervalId);
					}
				}
			} else { // 付费后
				if (guideDialogSwitch) { // 有弹窗频率，可关闭
					console.log(nowBuySpace, 'nowBuySpace----nowBuySpace-----nowBuySpace');
					console.log(this.awemeId, '抖音号----抖音号--抖音号-----抖音号----抖音号');
					if (nowBuySpace === guideSequence) {
						this.intervalId = setInterval(this.getFollowStatus, 1000);
						let statusFollow = await this.getFollowCheckStatus()
						this.statusFollow =statusFollow.hasFollowed
						console.log(statusFollow, '关注状态---关注状态---关注状态---5');
						if (!statusFollow.hasFollowed) {
							this.dyInterestShow = true
							this.$statis({
								action: 'EXPOSURE',
								position: 'DY_DIVERSION_DY_USER/DY_DIVERSION_AFTER_PAY',
							})
							if(!getApp().globalData.isOperateType){
								this.getMiddlePopup()
							}
						}
						console.log('支付后-----支付后-----支付后-----1');
					} else if (dialogRate && nowBuySpace > guideSequence && (nowBuySpace - guideSequence) % dialogRate === 0) {
						this.intervalId = setInterval(this.getFollowStatus, 1000);
						let statusFollow = await this.getFollowCheckStatus()
						this.statusFollow =statusFollow.hasFollowed
						console.log(statusFollow, '关注状态---关注状态---关注状态---6');
						if (!statusFollow.hasFollowed) {
							this.dyInterestShow = true
							this.$statis({
								action: 'EXPOSURE',
								position: 'DY_DIVERSION_DY_USER/DY_DIVERSION_AFTER_PAY',
							})
							if(!getApp().globalData.isOperateType){
								this.getMiddlePopup()
							}
						}
						console.log('支付后-----支付后-----支付后-----2');
					} else {
						this.pauseNum = 0
						this.dyInterestShow = false
						clearInterval(this.intervalId);
						console.log('支付后-----支付后-----支付后-----3');
					}

				} else { // 不可关闭
					if (nowBuySpace === guideSequence || nowBuySpace > guideSequence) {
						this.intervalId = setInterval(this.getFollowStatus, 1000);
						let statusFollow = await this.getFollowCheckStatus()
						this.statusFollow =statusFollow.hasFollowed
						console.log(statusFollow, '关注状态---关注状态---关注状态---7');
						if (!statusFollow.hasFollowed) {
							this.dyInterestShow = true
							this.$statis({
								action: 'EXPOSURE',
								position: 'DY_DIVERSION_DY_USER/DY_DIVERSION_AFTER_PAY',
							})
							if(!getApp().globalData.isOperateType){
								this.getMiddlePopup()
							}
						}
					} else {
						this.pauseNum = 0
						this.dyInterestShow = false
						clearInterval(this.intervalId);
					}
				}
			}
		},
		// 新播放器逻辑添加
		handleError(error) {
			console.log('video-err', error)
			let {
				detail
			} = error
			this.errorPopupVideo({
				videoUrlObj: this.videoInfoList[this.currentIndex],
				...(detail || {})
			})
		},
		getVideoInfoNewPlayer(e) {
			console.log('视频详情----', e)
		},
		isEndedNewPlayer(e) {
			console.log('endBox------', e)
			this.isEnded()
		},
		timeupdateNewPlayer(e) {
			this.showLoadingNewPlayer = false
			if (!this.isChanging) {
				this.currentTimeNewPlayer = e.detail.currentTime || 0
				this.durationNewPlayer = e.detail.duration || 0
			}
		},
		nowNewPlayVideo(id){
			
			this.$nextTick(() => {
				const query = uni.createSelectorQuery().in(this)
				query.selectAll(`#newPlayVideo${id}`).fields({
					dataset: true,
				}, data => {
					console.log('newPlayVideo----', data)
				}).exec()
				this.newContentVideo = uni.createVideoContext(`newPlayVideo${id}`)
			})
		},
		isPauseNewPlayer(type) {
			if (type == 'handPause') {
				const currentTimestamp = Math.floor(Date.now() / 1000);
				if (currentTimestamp - getApp().globalData.lastAdTimestamp > 180 && !getApp().globalData.isAdComeCheck) {
					// 曝光插屏广告
					// #ifdef MP-TOUTIAO
					this.$refs.insertAdTt && this.$refs.insertAdTt.isShowAd()
					// #endif
					console.log('Show interstitial ad');
					// getApp().globalData.lastAdTimestamp = currentTimestamp;
				} else {
					console.log('Skip interstitial ad');
				}
			}
			console.log('pause---', this.newContentVideo)
			if (this.newContentVideo != "") {
				this.newContentVideo.pause()
				this.isPlayNowNewPlayer = false;
			} else {
				if (_this.reqNum < 8) {
					_this.reqNum++
					setTimeout(() => {
						this.newContentVideo.pause()
					}, 500)
				}
			}
		},
		playNowNewPlayer() {
			console.log('play---', this.newContentVideo)
			if (this.newContentVideo != "") {
				console.log()
				this.newContentVideo.play()
				this.isPlayNowNewPlayer = true
			}
		},
		sliderEndNewPlayer(e) {
			console.log('sliderEnd', e)
			let nowTime = e
			console.log(this.newContentVideo)
			this.newContentVideo.seek(nowTime)
			this.newContentVideo.play()
			this.isPlayNowNewPlayer = true
			clearTimeout(this.changeTimer)
			this.changeTimer = setTimeout(() => {
				this.isChanging = false
			}, 500)
		},
		isChangingFuncNewPlayer() {
			this.isChanging = true
		},
		getMiddlePopup(){
			let _this = this
			_this.pauseNum = 1
			_this.isPauseNewPlayer()
			tt.followAwemeUser({
				awemeId: _this.awemeId,
				success: async (res) => {
					console.log("引导关注抖音号成功，已关注:", res.followed);
					let statusFollow = await _this.getFollowCheckStatus()
					_this.statusFollow =statusFollow.hasFollowed
					if (statusFollow.hasFollowed) {
						_this.dyInterestShow = false
						_this.getReportFollowed(_this.awemeId)
						_this.getEmpowerStatus(_this.awemeId)

					}
					_this.pauseNum = 0

				},
				fail: (res) => {
					console.log("引导关注抖音号失败，错误信息:", res.errMsg);
					_this.pauseNum = 0
				},
			});
		},
		async getReportFollowed(dyUserId){
			let res = await this.zwyRequest({
				method: 'get',
				url: `/blade/douyinCallback/follow?douYinUserId=${dyUserId}`
			})
		},
		async getFollowStatus() {
			try {
				const response = await this.getFollowCheckStatus();
				let followStatus = response.hasFollowed;
				this.statusFollow = followStatus
				if (followStatus) {
					this.dyInterestShow = false
					clearInterval(this.intervalId);
					console.log('哈哈哈哈哈哈哈哈哈哈--------', getApp().globalData.isEmpowerStatus);
					if (getApp().globalData.isEmpowerStatus) {
						await this.getEmpowerStatus(this.awemeId)
					}
					if(!getApp().globalData.isOperateType){
						this.getReportFollowed(this.awemeId)
					}
				}
			} catch (error) {
				console.error('Error checking follow status:', error);
			}
		},
		async getEmpowerStatus(dyUserId) {
			let res = await this.zwyRequest({
				method: 'get',
				url: `/douYin/diversion/record_auth?dyUserId=${dyUserId}`
			})
			let _this = this
			if (res && res.needAuth) {
				setTimeout(() => {
					tt.authorizePrivateMessage({
						imOpenId: getApp().globalData.dyInsertMess.openId,
						success: function (res) {
							console.log("success---私信---私信---私信", res)
							clearInterval(this.intervalId);
							_this.postEmpowerStatus(dyUserId)
						},
						fail: function (res) {
							console.log("fail---私信---私信---私信", res)
						},
						complete(res) {
							getApp().globalData.isEmpowerStatus = false
							console.log("complete---私信---私信---私信", res)
						}
					})
				}, 1000);
			}
		},

		async postEmpowerStatus(dyUserId) {
			let res = await this.zwyRequest({
				method: 'post',
				url: `/douYin/diversion/record_auth?dyUserId=${dyUserId}`
			})
			if (getApp().globalData.dyInsertMess.diversionSceneType == 1) {
				this.$statis({
					action: 'AUTH',
					position: 'DY_DIVERSION_DY_USER/DY_DIVERSION_BEFORE_PAY',
				})
			} else if (getApp().globalData.dyInsertMess.diversionSceneType == 2) {
				this.$statis({
					action: 'AUTH',
					position: 'DY_DIVERSION_DY_USER/DY_DIVERSION_AFTER_PAY',
				})
			}
			console.log(res, '上报状态');
		},
		async getGroupInfo(num, diversionTarget) {
			let res = await this.zwyRequest({
				method: 'get',
				url: `/douYin/diversion?diversionScene=${num}&diversionTarget=${diversionTarget}`
			})
			if (res && res[0]) {
				getApp().globalData.dyGroupMess = res[0]
				getApp().globalData.dyGroupMess.viewJqPopup = true
			}else{
				getApp().globalData.dyGroupMess.viewJqPopup = false
			}
			console.log(res[0],'导流群信息--------导流群信息-------导流群信息-------导流群信息-');
		},
		async getVideoBtnGroupInfo(num, diversionTarget) {
			let res = await this.zwyRequest({
				method: 'get',
				url: `/douYin/diversion?diversionScene=${num}&diversionTarget=${diversionTarget}`
			})
			if (res && res[0]) {
				this.dyBtnGroupId = res[0].groupId;
				this.taskIdBtn = res[0].id;
				this.$statis({
					action: 'EXPOSURE',
					position: 'DY_DIVERSION_DY_GROUP/DY_DIVERSION_PLAY_PAGE',
					taskId:this.taskIdBtn
				})
			}
		},
		// 导流模板一键加群卡点逻辑
		async addGroupInsert() {
			let {
				diversionSceneType,//导流场景 支付前，支付后
				guideSequence, // 卡点集数
				dialogRate, // 弹窗频率
				guideDialogSwitch, // 弹窗是否可关闭
				groupId,//群id
			} = getApp().globalData.dyGroupMess
			this.dyGroupId = groupId
			console.log(getApp().globalData.dyGroupMess, 'getApp().globalData.dyGroupMess.groupId------111111');
			let currentIndex = this.currentIndex + 1
			let nowBuySpace = this.hasBuyNum
			this.groupCloseSwitch = guideDialogSwitch
			if (!diversionSceneType || diversionSceneType == 1) { // 付费前
				if (guideDialogSwitch) { // 有弹窗频率，可关闭
					if (currentIndex === guideSequence) {
						this.pauseNum = 1
						// let count = 0;
						// this.closePopTime = setInterval(() => {
						// 	count++
						// 	if (count <= 4) {
						// 		this.setPause()
						// 	}
						// }, 400);
						this.$statis({
							action: 'EXPOSURE',
							position: 'DY_DIVERSION_DY_GROUP/DY_DIVERSION_BEFORE_PAY',
							taskId:getApp().globalData.dyGroupMess.id
						})
						this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.show('mid')
						console.log(groupId, '加群----加群--加群-----加群----加群11');
					} else if (dialogRate && currentIndex > guideSequence && (currentIndex - guideSequence) % dialogRate === 0) {
						this.pauseNum = 1
						// let count = 0;
						// this.closePopTime = setInterval(() => {
						// 	count++
						// 	if (count <= 4) {
						// 		this.setPause()
						// 	}
						// }, 400);
						this.$statis({
							action: 'EXPOSURE',
							position: 'DY_DIVERSION_DY_GROUP/DY_DIVERSION_BEFORE_PAY',
							taskId:getApp().globalData.dyGroupMess.id
						})
						this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.show('mid')
						console.log(groupId, '加群----加群--加群-----加群----加群22');
					} else {
						this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.close()
						this.pauseNum = 0
						// this.setPlay()
					}
				} else { // 不可关闭
					if (currentIndex === guideSequence || currentIndex > guideSequence) {
						this.pauseNum = 1
						// let count = 0;
						// this.closePopTime = setInterval(() => {
						// 	count++
						// 	if (count <= 4) {
						// 		this.setPause()
						// 	}
						// }, 400);
						this.$statis({
							action: 'EXPOSURE',
							position: 'DY_DIVERSION_DY_GROUP/DY_DIVERSION_BEFORE_PAY',
							taskId:getApp().globalData.dyGroupMess.id
						})
						this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.show('mid')
						console.log(groupId, '加群----加群--加群-----加群----加群33');
					} else {
						this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.close()
						this.pauseNum = 0
						// this.setPlay()
					}
				}
			} else { // 付费后
				if (guideDialogSwitch) { // 有弹窗频率，可关闭
					if (nowBuySpace === guideSequence) {
						this.pauseNum = 1
						// let count = 0;
						// this.closePopTime = setInterval(() => {
						// 	count++
						// 	if (count <= 4) {
						// 		this.setPause()
						// 	}
						// }, 400);
						this.$statis({
							action: 'EXPOSURE',
							position: 'DY_DIVERSION_DY_GROUP/DY_DIVERSION_AFTER_PAY',
							taskId:getApp().globalData.dyGroupMess.id
						})
						this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.show('mid')
						console.log(groupId, '加群----加群--加群-----加群----加群44');
					} else if (dialogRate && nowBuySpace > guideSequence && (currentIndex - guideSequence) % dialogRate === 0) {
						this.pauseNum = 1
						// let count = 0;
						// this.closePopTime = setInterval(() => {
						// 	count++
						// 	if (count <= 4) {
						// 		this.setPause()
						// 	}
						// }, 400);
						this.$statis({
							action: 'EXPOSURE',
							position: 'DY_DIVERSION_DY_GROUP/DY_DIVERSION_AFTER_PAY',
							taskId:getApp().globalData.dyGroupMess.id
						})
						this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.show('mid')
						console.log(groupId, '加群----加群--加群-----加群----加群55');
					} else {
						this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.close()
						this.pauseNum = 0
						// this.setPlay()
					}
				} else { // 不可关闭
					if (nowBuySpace === guideSequence || nowBuySpace > guideSequence) {
						this.pauseNum = 1
						// let count = 0;
						// this.closePopTime = setInterval(() => {
						// 	count++
						// 	if (count <= 4) {
						// 		this.setPause()
						// 	}
						// }, 400);
						this.$statis({
							action: 'EXPOSURE',
							position: 'DY_DIVERSION_DY_GROUP/DY_DIVERSION_AFTER_PAY',
							taskId:getApp().globalData.dyGroupMess.id
						})
						this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.show('mid')
						console.log(groupId, '加群----加群--加群-----加群----加群66');
					} else {
						this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.close()
						this.pauseNum = 0
						// this.setPlay()
						
					}
				}
			}
		},
		async handleCloseDyPopup(){
			// clearInterval(this.closePopTime);
			await this.$nextTick()
			this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.close()
			this.pauseNum = 0
			// this.setPlay()
		},
		async handleJoinGroup1(type,e){
			let { diversionSceneType } = getApp().globalData.dyGroupMess  //导流场景 支付前，支付后
			if(type == 1){
				this.$statis({
					action: 'CLICK',
					position: 'DY_DIVERSION_DY_GROUP/DY_DIVERSION_PLAY_PAGE',
					taskId:this.taskIdBtn
				})
			}else{
				if(!diversionSceneType || diversionSceneType == 1){
					this.$statis({
						action: 'CLICK',
						position: 'DY_DIVERSION_DY_GROUP/DY_DIVERSION_BEFORE_PAY',
						taskId:getApp().globalData.dyGroupMess.id
					})
				}else{
					this.$statis({
						action: 'CLICK',
						position: 'DY_DIVERSION_DY_GROUP/DY_DIVERSION_AFTER_PAY',
						taskId:getApp().globalData.dyGroupMess.id
					})
				}
			}

			console.log(type,'type---type');
			// clearInterval(this.closePopTime);
			this.closePopTime = null;
			await this.$nextTick()
			setTimeout(()=>{
				this.$refs.dyGroupPopupBox && this.$refs.dyGroupPopupBox.close()
				this.pauseNum = 0
				// this.setPlay()
			},500)

		},
		// 检查广告是否还能曝光，次数上限制
		async getAdLockStatus() {
			try {
				let res = await this.zwyRequest({
					method: 'get',
					url: `/attribute_server_api/ad/unlock/limit/check`
				})
				return res
			} catch (error) {
				
			}
		},
		// 通用支付365
		async payMessSsVipNew(res, payType) {
			if(!['Douyin', 'douyin', 'devtools'].includes(this.nowAppName) && this.versionView) {
				uni.showToast({
					title: 'ios设备暂不支持此功能',
					icon: 'none'
				})
				return
			}
			// 咱们内部的OrderID
			let {
				orderId,
				touTiaoGeneralPayApi
			} = res
			let orderMessNew = await getOrderTtMess(touTiaoGeneralPayApi)
			if(orderMessNew) {
				// 抖音订单的OrderId
				let objPayView = {
					...orderMessNew
				}
				if(this.versionView) {
					objPayView.imId = this.imId
				} else {
					delete objPayView.imId
				}
				await intoPayPage(objPayView)
				// 同步跳转更新
				if(this.versionView) {
					uni.setStorageSync('imJump', payType)
					uni.setStorageSync('imJumpNewObj', {
						orderId: orderId
					})
				} else {
					// 咱们内部的OrderID
					this.getOrderInfo(orderId)
				}
			}
		},
		// 返回首页
		backIndexPage() {
			console.log('backIndexPage');
			// #ifdef MP-TOUTIAO
			this.isBack();
			// this.topBack();
			// #endif 
			// #ifdef MP-KUAISHOU
			this.topBack('leftTop')
			// #endif 
		},
		// 判断是否记录IAA广告信息
		checkAddIaaMess() {

			// 统一处理激励广告展示的逻辑
			if (this.isIaaAd) {
				if (this.adMessAll.iaaUnlockTimes >= 0) { // 有限次
					// 次数不为0则可以拉起广告解锁
					let count = (uni.getStorageSync('adLockCount') || {}).count || 0
					let canViewNum = this.adMessAll.iaaUnlockTimes - count
					console.log('观看广告剩余次数1', canViewNum)
					if (canViewNum > 0) {
						this.setIndexViewData()
					} else {
						uni.removeStorageSync('indexAdViewMess')
					}
				} else { // 无限次
					this.setIndexViewData()
				}
			} else {
				uni.removeStorageSync('indexAdViewMess')
			}
		},
		// 记录IAA解锁信息
		setIndexViewData() {
			let messVideo = this.videoList.length ? this.videoList[this.currentIndex] : {}
			let nowVideoObj = this.videoList.find(item => item && item['goodsLocks'].find(item => item.releaseWay == 'WATCH_THE_ADS'))
			let tempUrl = `/cdp/payment/ads_unlock/episodic_drama/${nowVideoObj.id}`;
			let lockId = (nowVideoObj['goodsLocks'].find(item => item.releaseWay == 'WATCH_THE_ADS') || {}).id || ''
			let obj = {
				fakeId: this.compInfo.fakeId,
				coverImgUrl: messVideo.coverImgUrl, // 封面
				lockId: lockId, // 锁Id
				tempUrl: tempUrl, // 请求地址
				ticket: this.iaaUnLockStr
			}
			uni.setStorageSync('indexAdViewMess', obj)
		},
		async setTimeAll() {
			if(this.viewAdTime) {
				let res = await this.getAdLockStatus()
				let hasNum = res.exposeAd // 是否还有次数
				if(!hasNum) {
					this.viewAdTime = 0
					return 
				}
				this.interValTime = setInterval(() => {
					this.viewAdTime--
					if(this.viewAdTime <= 0) {
						// #ifdef MP-KUAISHOU
						this.nowAdTypeKs = 'iaaAd'
						this.$refs.rewardAd && this.$refs.rewardAd.isShowAd()
						// #endif
						// #ifdef MP-TOUTIAO
						this.$refs.rewardAdTt && this.$refs.rewardAdTt.isShowAd()
						// #endif
						clearInterval(this.interValTime)
					}
				}, 1000)
			}
		},
		// IAA广告关闭
		handleIaaClose() {
			this.showMoney = false
			this.viewAdTime = 3
			this.positionIaa = 'moneyPop'
			this.topBack()
		}
	}
};
</script>

<style lang="scss">
	
	.joinBtn{
		opacity: 0;
		z-index:10;
		position: absolute;
		width: 100%;
		height: 100%;
	}
	.isContent{
		position: relative;
	}
	.isDes{
		text-align: center;
		margin: 100rpx 0;
	}
	.closeImg{
		width: 60rpx;
		height: 60rpx;
		position:absolute;
		z-index:11;
		bottom: -100rpx;
		left: 0;
		right: 0;
		margin: auto;
	}
	.isBtn{
		text-align: center;
		width: 200rpx;
		height: 70rpx;
		color:white;
		border-radius: 70rpx;
		line-height: 70rpx;
		background-color: #ffaa00;
	}
	.chatBox{
		// width: 550rpx;
		// background-color: white;
		display: flex;
		position: relative;
		align-items: center;
		flex-direction: column;
		justify-content: center;
		// border-radius: 33rpx;
		// padding-bottom: 40rpx;
		// padding-top: 41rpx;
	}
	
.content-popup {
	width: 562rpx;
	height: 334rpx;
	background: #FFFEFE;
	border-radius: 30rpx;
	position: relative;

	.img-box {
		font-size: 52rpx;
		font-family: Source Han Sans CN;
		font-weight: bold;
		color: #8D4311;
		text-align: center;
		padding-top: 47rpx;
	}

	.code-mess {
		font-size: 36rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #C5743D;
		margin-top: 24rpx;
		text-align: center;
		display: flex;
		align-items: center;
		justify-content: center;

		.line {
			width: 34rpx;
			height: 3rpx;
			background: #C5743D;
		}
	}

	.content-btn {

		width: 417rpx;
		height: 114rpx;
		background: url("https://res.qiguoread.com/staticResources/fellow_townsman/image/group_btn_bg.png");
		background-size: 100% 100%;
		font-size: 40rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #FFFFFF;
		margin: 0 auto;
		text-align: center;
		line-height: 106rpx;
		margin-top: 20rpx;
	}

	.close-btn {
		position: absolute;
		top: -50rpx;
		right: -50rpx;
		width: 50rpx;
		height: 50rpx;
	}
}

.content-popup1 {
	position: relative;
}

.content-popup2 {
	width: 100vw;
	height: 100vh;
	position: relative;
}

.close-btn3 {
	position: absolute;
	bottom: 431rpx;
	right: 21rpx;
	width: 50rpx;
	height: 50rpx;
}

.add-group {
	width: 554rpx;
	height: 488rpx;
	background: url("https://res.qiguoread.com/staticResources/fellow_townsman/image/add_group2.png");
	background-size: 100% 100%;
}

.add-group1 {
	width: 100vw;
	height: 410rpx;
	position: absolute;
	bottom: 0;
	background: url("https://res.qiguoread.com/staticResources/fellow_townsman/image/add_group3.png");
	background-size: 100% 100%;
}

.close-btn2 {
	position: absolute;
	bottom: -90rpx;
	left: 50%;
	width: 50rpx;
	height: 50rpx;
	transform: translateX(-50%);
}

.videoZan-play {
	color: red;
	width: 430rpx;
	height: 430rpx;
	position: fixed;
	margin: auto;
	right: 32rpx;
	// right: 0;
	z-index: 999999;
	bottom: 636rpx;
	// top: 0;
}

.videoZan-play {
	position: fixed;
	animation: grow 0.6s linear;
	transform: scale(0);
	color: red;
}

@keyframes grow {
	to {
		transform: scale(1);
		opacity: 0;
	}
}

.ad-box-all {
	position: relative;

	.img-box-ad {
		width: 602rpx;
	}

	.close-btn {
		position: absolute;
		right: 0;
		top: -40rpx;
		width: 56rpx;
	}

	.mark-btn {
		position: absolute;
		right: -10rpx;
		bottom: 15rpx;
		width: 140rpx;
		z-index: 1;
	}
}

.fixed-button {
	position: fixed;
	z-index: 9999;
	left: 50%;
	transform: translateX(-50%);
	bottom: calc(env(safe-area-inset-bottom) + 170rpx);

	.btn-style {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 67rpx;
		border-radius: 67rpx;
		background: #f36d86;
		border-radius: 34rpx;
		text-align: center;
		line-height: 67rpx;
		color: #fff;
		font-size: 32rpx;
		padding: 0 68rpx;
	}
}

.text-one {
	font-size: 40rpx;
	font-weight: 600;
	color: #fff;
	line-height: 48rpx;
	letter-spacing: 2rpx;
	margin: 32rpx 0 8rpx;

	&.text-black {
		color: #333333;
	}
}

.text-two {
	color: #D8D8D8;
	font-size: 28rpx;
	line-height: 40rpx;
}

.text-three {
	font-size: 32rpx;
	color: #333;
	margin: 32rpx 0 36rpx;

	.num-box {
		font-size: 46rpx;
		line-height: 46rpx;
		color: #FB4B06;

	}
}

.isFangqi {
	text-align: center;
	height: 45rpx;
	font-size: 32rpx;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.5);
	line-height: 45rpx;
	position: absolute;
	bottom: -60rpx;
	left: 0;
	right: 0;
	margin: auto;
}

.ksRightUse {
	width: 338rpx;
	height: 73rpx;
	background: linear-gradient(177deg, #FFEFDA 0%, #FEDCAD 100%);
	box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(153, 2, 30, 0.5);
	border-radius: 42rpx;
	text-align: center;
	color: #B52327;
	font-size: 32rpx;
	line-height: 73rpx;
	position: absolute;
	right: 0;
	left: 0;
	margin: auto;
	bottom: 54rpx;
	font-weight: 500;
	color: #B52327;

}

.czButton {
	width: 448rpx;
	height: 102rpx;
	position: absolute;
	bottom: -130rpx;
	left: 0;
	right: 0;
	margin: auto;
}

.oriKb {
	font-size: 28rpx;
	color: rgba(255, 255, 255, 0.54);
	line-height: 40rpx;
	position: absolute;
	left: 0;
	right: 0;
	bottom: -200rpx;
	margin: 0;
	text-align: center;
	text-decoration: line-through;
}

.afterBtn1 {
	position: absolute;
	left: 0;
	font-size: 36rpx;
	color: #D83100;
	font-weight: bold;
	right: 0;
	text-align: center;
	line-height: 88rpx;
	bottom: 246rpx;
	width: 418rpx;
	height: 88rpx;
	margin: auto;
	background: linear-gradient(180deg, #F8CEBC 0%, #DAA880 100%);
	border-radius: 44rpx;
}

.afterBtn2 {
	font-size: 36rpx;
	font-weight: bold;
	color: #742100;
	text-align: center;
	line-height: 88rpx;
	margin: auto;
	position: absolute;
	left: 0;
	right: 0;
	width: 418rpx;
	bottom: 132rpx;
	height: 88rpx;
	background: linear-gradient(180deg, #FECA80 0%, #FF9105 100%);
	box-shadow: inset 0rpx 1rpx 3rpx 0rpx rgba(255, 255, 255, 0.5);
	border-radius: 44rpx;
}

.czPopupTTAfterKS {
	width: 534rpx;
	height: 642rpx;
}

.czPopupTTAfter {
	width: 686rpx;
	height: 762rpx;
}

.closeBlackKS {
	margin: auto;
	width: 61rpx;
	height: 61rpx;
	position: absolute;
	right: 0;
	top: -50rpx;
}

.closeBlack {
	margin: auto;
	width: 61rpx;
	height: 61rpx;
	position: absolute;
	right: 0;
	bottom: -50rpx;
	left: 0;
}

.timeBoxCzKS {
	color: #AC561A;
	z-index: 999;
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	right: 0;
	left: 0;
	top: 359rpx;
}

.timeBoxCz {
	color: #AC561A;
	z-index: 999;
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	right: 0;
	left: 0;
	top: 20rpx;
}

.czPopupKSBox {
	margin-bottom: 300rpx;
	width: 557rpx;
	height: 649rpx;
	position: relative;
}

.czPopupTTBoxKS {
	width: 534rpx;
	height: 642rpx;
	position: relative;
}

.czPopupTTBox {
	width: 694rpx;
	height: 745rpx;
	position: relative;
}

.czPopupKS {
	width: 557rpx;
	height: 649rpx;
}

.czPopupTT {
	width: 694rpx;
	height: 745rpx;
}

.KScolor {
	background: linear-gradient(339deg, #F36D86 0%, #FF70A2 100%) !important;
}

.TTcolor {
	background: linear-gradient(340deg, #D283FF 0%, #7BB1FD 100%) !important;
}

.swiperPoster {
	bottom: auto;
	background-color: black;
	position: absolute;
	left: 0;
	width: 100%;
	z-index: 98;
}

.adFailBox {
	.btnBox {

		.nomalBtn,
		.mainBtn {
			width: 230rpx;
			height: 75rpx;
			text-align: center;
			line-height: 75rpx;
			border-radius: 38rpx;
			font-size: 32rpx;
		}

		.nomalBtn {
			margin-right: 14rpx;
			color: #666666;
			border: 1rpx solid #999999;
		}

		.mainBtn {
			background: #ff6e17;
			color: #ffffff;
		}

		width: 100%;
		margin-top: 47rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.adFailTitle {
		width: 100%;
		text-align: center;
		color: #333333;
		font-size: 34rpx;
		font-weight: bold;
	}

	.adFailDes {
		text-align: center;
		margin-top: 25rpx;
		color: #333333;
		font-size: 28rpx;
	}

	width: 550rpx;
	background-color: white;
	border-radius: 33rpx;
	padding-bottom: 40rpx;
	padding-top: 41rpx;
}

.container999 {
	background-color: black;
}

.titleBox {
	.titleSureBtn {
		width: 434rpx;
		height: 80rpx;
		display: flex;
		align-items: center;
		margin: auto;
		position: relative;
		justify-content: center;
		background: #f66e8e;
		border-radius: 40rpx;
		color: white;
	}

	.isChoose {
		color: green;
	}

	.titleLine {
		.isChoose {
			display: flex;
			align-items: center;
			justify-content: center;
			width: 10%;
		}

		.titleDetail {
			width: 60%;
		}

		.titileNum {
			width: 30%;
			padding-left: 20rpx;
		}

		min-height: 36px;
		font-size: 28rpx;
		display: flex;
		align-items: center;
		justify-content: flex-start;
	}

	.isTitle {
		width: 100%;
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 32rpx;
		font-weight: bold;
	}

	width: 628rpx;
	height: 710rpx;
	background-color: white;
	border-radius: 20rpx;
}

.newPlay {
	width: 150rpx;
	height: 150rpx;
	position: fixed;
	left: 50%;
	transform: translateX(-50%);
	// right: 0;
	z-index: 999;
	margin: auto;
	bottom: 591rpx;
	// top: 0;
}

.hoverBtn {
	opacity: 0.5;
}

.decorate {
	font-size: 20rpx;
	margin-right: 16rpx;
}

.moneyNum {
	font-size: 60rpx;
	font-weight: bold;
	color: #613a00;
	position: absolute;
	left: 0;
	right: 0;
	text-align: center;
	margin: auto;
	top: 430rpx;
}

.popupDesc {
	font-size: 35rpx;
	font-weight: bold;
	position: absolute;
	left: 0;
	right: 0;
	text-align: center;
	margin: auto;
	top: 371rpx;
}

.userName {
	font-size: 30rpx;
	font-weight: bold;
	color: #c69648;
	position: absolute;
	left: 0;
	right: 0;
	text-align: center;
	margin: auto;
	top: 250rpx;
}

.portraitImg {
	width: 156rpx;
	height: 156rpx;
	border-radius: 50%;
	position: absolute;
	left: 0;
	right: 0;
	margin: auto;
	top: 81rpx;
}

.isCloseBox {
	position: absolute;
	top: -70rpx;
	right: 0;
	width: 100rpx;
	height: 100rpx;
}

.COMPILATIONS {
	background-image: url('https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/bg_red.png') !important;

	.popupDesc,
	.moneyNum {
		color: #fecc81 !important;
	}

	.downloadBtn {
		color: #ed523c !important;
		background-image: linear-gradient(90deg, #ffede0 0%, #ffd7bd 100%);
	}
}

.EPISODIC_DRAMA {
	background-image: url('https://res.qiguoread.com/staticResources/fellow_townsman/image/uni/bg_yellow.png') !important;

	.popupDesc,
	.moneyNum {
		color: #613a00 !important;
	}

	.downloadBtn {
		color: #f0cd96 !important;
		background-image: linear-gradient(135deg, #533320 0%, #212121 100%);
	}
}

.cardBox {
	background-repeat: no-repeat;
	background-size: 100% 100%;
	background-position: center center;
	width: 628rpx;
	height: 710rpx;
	border-radius: 30rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
}

.cardDes {
	font-size: 30rpx;
	text-align: center;
}

.downloadBtn {
	position: absolute;
	top: 535rpx;
	left: 0;
	right: 0;
	margin: auto;
	text-align: center;
	line-height: 81rpx;
	width: 432rpx;
	color: #f0cd96;
	font-size: 34rpx;
	font-weight: bold;
	height: 81rpx;
	box-shadow: 0rpx 2rpx 11rpx 0rpx rgba(54, 32, 0, 0.4);
	border-radius: 41rpx;
}

.isBack {
	width: 18rpx;
	height: 32rpx;
}

.backTitle {
	position: absolute;
	left: 60rpx;
	top: 26rpx;
	margin: auto;
	font-size: 32rpx;
	font-weight: normal;
	width: 160rpx;
}

.videoChoose {
	position: relative;
	z-index: 98;
	width: 100vw;
	display: flex;
	align-items: center;
	justify-content: center;
}

.videoBox {
	will-change: transform;
	position: relative;
	z-index: 98;
	width: 100vw;
	height: calc(100vh - 132rpx - env(safe-area-inset-bottom));
	display: flex;
	align-items: center;
	justify-content: center;
}

.isVideo {
	width: 100vw;
	height: calc(100vh - 132rpx - env(safe-area-inset-bottom));
}

.isBorder {
	border-bottom: 1rpx solid #f2f2f2;
}

.popup-guide {
	position: fixed;
	left: 0;
	top: 0;
	width: 100vw;
	height: 100vh;
	background: rgba(0, 0, 0, .4);
	z-index: 999;

	.content-box {
		width: 100%;
		height: 100%;
		font-size: 30rpx;
		color: #ffffff;
	}

	.img-one {
		width: 141rpx;
		height: 168rpx;
		margin-block: 37rpx;
	}

	.img-two {
		width: 141rpx;
		height: 233rpx;
		margin: 240rpx 0 4rpx;
	}
}

.loginFlag {
	position: fixed;
	bottom: 0;
	left: 0;
	width: 100vw;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	border-radius: 50rpx 50rpx 0 0;
	z-index: 9999;
	padding-bottom: 75rpx;

	.loginFlag-top {
		position: relative;
		margin-top: 65rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100vw;

		.login-title {
			font-size: 38rpx;
			font-family: PingFangSC-Medium, PingFang SC;
			font-weight: 500;
			color: #333333;
			text-align: center;
		}

		.close-img {
			width: 46rpx;
			height: 46rpx;
			position: absolute;
			right: 58rpx;
		}
	}

	.login-text {
		font-size: 30rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		text-align: center;
		margin: 98rpx auto 85rpx auto;
	}

	.icon-content {
		width: 591rpx;
		height: 104rpx;
		margin: 88rpx auto 75rpx auto;
	}

	.loginFlag-btn {
		width: 600rpx;
		height: 85rpx;
		background: #2C8AFF;
		border-radius: 43px;
		margin: 0 auto;
		font-size: 32rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		border: none;
		outline: none;
	}
}

.safeguard {
	width: 134rpx;
	height: 128rpx;
	position: fixed;
	top: 180rpx;
	right: 34rpx;
	z-index: 99;
}

button::after {
	border: none;
}

.follow-bottom {
	position: fixed;
	bottom: 100rpx;
	left: 30rpx;
	z-index: 1000;
	width: calc(100% - 60rpx);
}


.guide-box {
	width: 600rpx;
	background: #FFFFFF;
	border-radius: 33rpx;
	box-sizing: border-box;
	padding: 47rpx 51rpx;
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
}

.guide-box .title {
	font-size: 36rpx;
	font-family: SourceHanSansCN-Medium, SourceHanSansCN;
	font-weight: 500;
	color: #3D270B;
	line-height: 54rpx;
	margin-bottom: 28rpx;
}

.guide-box .text-box {
	font-size: 32rpx;
	font-family: PingFangSC-Regular, PingFang SC;
	font-weight: 400;
	color: #333333;
	line-height: 40rpx;
}

.guide-box .btn-set {
	width: 400rpx;
	height: 75rpx;
	text-align: center;
	line-height: 75rpx;
	background: #FF6E17;
	border-radius: 38rpx;
	font-size: 32rpx;
	font-family: PingFangSC-Regular, PingFang SC;
	font-weight: 400;
	color: #FFFFFF;
	margin-top: 28rpx;
}

.guide-box .img-box {
	width: 143rpx;
	height: 143rpx;
	margin-bottom: 28rpx;
}

.guide-box .close-btn {
	position: absolute;
	right: 38rpx;
	top: 38rpx;
	width: 28rpx;
	height: 28rpx;
}

.padding-set {
	padding: 52rpx 0 38rpx;
}

.zwyVideoBox {
	bottom: auto;
	background-color: black;
	position: absolute;
	left: 0;
	width: 100%;
	z-index: 98;
}
.icp-box {
	position: absolute;
	left: 40rpx;
	bottom: 168rpx;
	// background: rgba(0, 0, 0, 0.5);
	color: #fff;
	opacity: 0.6;
	padding: 8rpx 12rpx;
	z-index: 99;
}

.uid-box {
	position: absolute;
	top: 200rpx;
	right: 40rpx;
	color: #fff;
	padding: 8rpx 12rpx;
	opacity: 0.3;
	transform-origin: center center;
	transform: rotate(45deg);
	z-index: 99;
}
.dy-popup-Box{
	background-image: url('https://res.qiguoread.com/staticResources/fellow_townsman/image/jiaqun_video_bg.png');
	background-size: cover;
	width: 620rpx;
	height: 700rpx;
	// background: #FFFEFE;
	border-radius: 30rpx;
	position: relative;
	.close-btn{
		width: 28rpx;
		height: 28rpx;
		position: absolute;
		right: 35rpx;
		top: 30rpx;
	}
	.add-group-btn{
		width: 494rpx;
		height: 104rpx;
		// line-height: 104rpx;
		background: linear-gradient(90deg, #F3C16B 0%, #EE7F99 48%, #E959BA 100%);
		border-radius: 52rpx;
		font-size: 42rpx;
		font-family: PingFangSC-Semibold, PingFang SC;
		font-weight: 600;
		color: #FFFFFF;
		position: absolute;
		bottom: 50rpx;
		left: 50%;
		transform: translateX(-50%);

	}
}
.jg-popup-Box{
	// background-image: url('https://res.qiguoread.com/staticResources/fellow_townsman/image/jiaqun_video_bg.png');
	// background-size: cover;
	width: 620rpx;
	height: 700rpx;
	background: #FFFEFE;
	border-radius: 30rpx;
	position: relative;
}
.video-group-btn{
	background-image: url('https://res.qiguoread.com/staticResources/fellow_townsman/image/jiaqun_video_icon.png');
	background-size: cover;
	width: 79rpx;
	height: 200rpx;
}

.top-alert {
	position: fixed;
	left: 26rpx;
	top: 0;
	z-index: 102;
	display: flex;
	align-items: center;
	width: 240rpx;
	color: #ffffff;
	font-size: 32rpx;
	font-weight: bold;
	.left-box {
		margin-right: 24rpx;
	}
}

.time-box {
	width: 311rpx;
	height: 27rpx;
	font-size: 28rpx;
	font-family: Source Han Sans CN;
	font-weight: bold;
	color: #FFFFFF;
	margin: 0 auto;
}
</style>
